Grid loads but no records are loaded, error pop-up

QuestionsGrid loads but no records are loaded, error pop-up
Oliver asked 2 years ago

bought the grid yesterday and installed it as indicated

when loading my demo page data is not loaded into the grid, error popup shows JSON data, tried it with various browsers, does not work

no data / html is echoed before the php part, cannot be the root cause of the error

5 Answers
Abu answered 2 years ago

Hello,

Please share your code for review.

Oliver answered 2 years ago
<?php
/**
 * PHP Grid Component
 *
 * @author Abu Ghufran <[email protected]> - http://www.phpgrid.org
 * @version 2.0.0
 * @license: see license.txt included in package
 */
include_once("../vocabulary-online.com/gridphp/config.php");
// include and create object
require 'conn_localhost.php';
include(PHPGRID_LIBPATH."inc/jqgrid_dist.php");
// Database config file to be passed in phpgrid constructor
$db_conf = array(
    "type"        => PHPGRID_DBTYPE,
    "server"   => PHPGRID_DBHOST,
    "user"        => PHPGRID_DBUSER,
    "password"     => PHPGRID_DBPASS,
    "database"     => PHPGRID_DBNAME
);
$g = new jqgrid($db_conf);
$grid["caption"] = "Sample Grid";
$g->set_options($grid);
$g->table = "sys_languages";
$out = $g->render("list10");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" type="text/css" media="screen" href="gridphp/lib/js/themes/redmond/jquery-ui.custom.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="gridphp/lib/js/jqgrid/css/ui.jqgrid.css" />
    <script src="gridphp/lib/js/jquery.min.js" type="text/javascript"></script>
    <script src="gridphp/lib/js/jqgrid/js/i18n/grid.locale-en.js" type="text/javascript"></script>
    <script src="gridphp/lib/js/jqgrid/js/jquery.jqGrid.min.js" type="text/javascript"></script>
    <script src="gridphp/lib/js/themes/jquery-ui.custom.min.js" type="text/javascript"></script>
</head>
<body>
<div>
    <?php echo $out ?>
</div>
</body>
</html>
Abu answered 2 years ago

It seems like there is some white space in one of the included files.

e.g. Check ‘conn_localhost.php’
There are usually 2 reasons for this.

1) Blank space character at start of grid file OR before render() function (new line etc)
White spaces can be removed by checking top and end of all included files.
2) Invisible BOM character at start of file
To remove invisible BOM character, i would recommend Notepad++ -> Open file -> Encoding menu -> Encode UTF without BOM

Martin Mata answered 2 years ago

I have the same issue, could you inform if you fix the problem?

Tasagore Seibei answered 2 years ago

Don’t know if it helps but…

I’ve a proxy server (apache2) and a internal webserver (apache2). If I try to reach the demos from the external URL, example https://www.mydomain.com/test/grid/index.php all the grids are blank and shows a “error” popup, but if I reach the demos directly to the webserver from the internal network, example http://192.168.100.12/test/grid/index.php all works fine.

No errors in the apache (proxy or webserver). Any hint?

Tasagore Seibei replied 2 years ago

Solved, in that environment seems that Grid does not detect properly http/https header. I’ve forced it to https and now all works fine.

Your Answer

3 + 5 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?