Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6844771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:25:08+00:00 2026-05-27T00:25:08+00:00

For one reason or another, the front end (HTML) of my jqGrid plugin is

  • 0

For one reason or another, the front end (HTML) of my jqGrid plugin is not communicating properly with the back-end (PHP) of the plugin. I have spent five hours on this now, and I have absolutely nothing to show for it. I have tried both XML as well as jSon methods. i have a feeling I am using an outdated back-end method; however, I cannot be sure as I can’t find that great of documentation. I will post my code here as I’m literally falling asleep writing this, and will check back for an update asap (taking a quick nap).

Front End

<?php 
require_once 'tabs.php';
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
  <head>
    <title>jQuery jqGrid Demonstration</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" type="text/css" media="screen" href="themes/redmond/jquery-ui-1.8.2.custom.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="themes/ui.jqgrid.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="themes/ui.multiselect.css" />

    <script src="js/jquery.js" type="text/javascript"></script>
    <script src="js/jquery-ui-custom.min.js" type="text/javascript"></script>
    <script src="js/i18n/grid.locale-en.js" type="text/javascript" ></script>

    <script type="text/javascript">
        $.jgrid.no_legacy_api = false;
        $.jgrid.useJSON = true;
    </script>

    <script type="text/javascript" src="js/jquery.jqGrid.min.js"></script>

<script type="text/javascript">
//<![CDATA[
    $(document).ready(function() {
        // first create the grid
        $('#grid').jqGrid({
    url:'grid.php',
    datatype: "json",
    height: 100,
    width: 900,
    colNames:['Customer ID','Hardware ID', 'Username','Password','Email','Last Login','Last IP','Registration Date','Expire Date'],
    colModel:[
        {name:'customerid',index:'customerid', width:150},
        {name:'hardware_id',index:'hardware_id', width:150},
        {name:'username',index:'username', width:100},
        {name:'password',index:'password', width:100},
        {name:'email',index:'email', width:100},
        {name:'lastlogin',index:'lastlogin', width:100},
        {name:'lastipaddress',index:'lastipaddress', width:100},
        {name:'registration_date',index:'registration_date', width:100},
        {name:'expire_date',index:'expire_date', width:100}
    ],
    rowNum:5,
    rowList:[5,8,10,20,30], 
    mtype: "GET",
    gridview: true,
    pager: '#pager',
    sortname: 'customerid',
    viewrecords: true,
    sortorder: "desc",
    caption: "Virtual scrolling on local data"
});

jQuery("#grid").jqGrid('navGrid','#pager2',{edit:false,add:false,del:false});
        // now you can any time change the width of the grid
        $('#grid').jqGrid('setGridWidth', 900);


    });

//]]>
</script>
  </head>

  <body>
      <div>
          <?php include ("grid.php");?>
      </div>
      <div id="pager"></div>

   </body></html> 

Back End – Grid.php

<?php

    include '../dbc.php';
    page_protect();
    require_once 'jq-config.php';
    // include the jqGrid Class
    require_once ABSPATH."php/jqGrid.php";
    // include the driver class
    require_once ABSPATH."php/jqGridPdo.php";
    // Connection to the server

    $link = new PDO(DB_DSN,DB_USER,DB_PASSWORD);
    // Tell the db that we use utf-8
    $link ->query("SET NAMES utf8");

    // Create the jqGrid instance
    $grid = new jqGridRender($link);

    $username = $_SESSION['user_name'];
    $grid->SelectCommand = "SELECT * FROM tblcustomer_$username";
    // set the ouput format to json
    $grid->dataType = 'json';
    // Let the grid create the model
    $grid->setColModel();
    // Set the url from where we obtain the data
    $grid->setUrl('grid.php');
    // Set some grid options
    $grid->setGridOptions(array("rowNum"=>100,"sortname"=>"customerid","height"=>150));

    // Change some property of the field(s)
    $grid->setColProperty("lastlogin", array(
        "formatter"=>"date",
        "formatoptions"=>array("srcformat"=>"Y-m-d H:i:s","newformat"=>"m/d/Y"),
        "search"=>false,
        "width"=>"400"
        ));
    // Registration date
    $grid->setColProperty("registration_date", array(
        "formatter"=>"date",
        "formatoptions"=>array("srcformat"=>"Y-m-d H:i:s","newformat"=>"m/d/Y"),
        "search"=>false,
        "width"=>"400"
        ));
    $grid->setColProperty("expire_date", array(
        "formatter"=>"date",
        "formatoptions"=>array("srcformat"=>"Y-m-d H:i:s","newformat"=>"m/d/Y"),
        "search"=>false,
        "width"=>"400"
        ));
    $grid->setColProperty("customerid",array("width"=>"650"));
    $grid->setColProperty("hardware_id",array("width"=>"250"));
    $grid->setColProperty("username",array("width"=>"150"));
    $grid->setColProperty("password",array("width"=>"150"));
    $grid->setColProperty("email",array("width"=>"150"));
    $grid->setColProperty("lastipaddress",array("width"=>"100"));

    $grid->setFilterOptions(array("stringResult"=>true));
    $grid->navigator=true;
    $grid->setNavOptions('navigator',array("excel"=>true,"add"=>true,"edit"=>true,"view"=>true,"del"=>true,"search"=>true));
    // Enjoy
    $grid->renderGrid('#grid','#pager',true, null, null, true,true);
    $link = null;
    ?> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T00:25:09+00:00Added an answer on May 27, 2026 at 12:25 am

    I don’t use myself any commercial version of jqGrid like jqSuite or jqGrid for PHP, but after the first look at the demo page I could see some problems in your code:

    Your code is a mix from the jqGrid and the code of the commercial version of jqGrid.

    If you use jqGrid for PHP you should remove the code in $(document).ready(function() {/*the code should be removed*/. Because you use the line

    $grid->renderGrid('#grid','#pager',true, null, null, true,true);
    

    in your PHP code you should the body of your HTML code to

    <div> 
        <?php include ("grid.php");?> 
    </div>
    

    In the case the HTML fragment <table id="grid"></table><div id="page"></div> will produces the PHP code you you.

    If you don’t use the commercial version of jqGrid you should include <table id="grid"></table> in your HTML code. You should also change '#pager2' parameter of 'navGrid' to '#pager'. To have the grid filled with the data you need change url parameter of jqGrid to any URL which provide JSON data for the grid. See the documentation about the format of the JSON data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some classes that, for one reason or another, cannot be or need
I've scrapped all the tutorials that have never worked for one reason or another,
For one reason or another, I have a few nasty JSON files in my
For one reason or another I had to empty folder in my subversion repository
That's the question. Give only one reason you think why have OODB failed or
For some reason one installation of Moodle 1.9.3+ has a problem that file.php returns
It's widely considered that the best reason to validate one's HTML is to ensure
For one reason or another, I sometimes find it useful or just interesting to
My apologies once again for asking another very junior question. For one reason or
I have a need to be able to identify one system from another in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.