JQuery JQGrid local data loading issue

Posted by ollie314 on Stack Overflow See other posts from Stack Overflow or by ollie314
Published on 2010-06-15T21:03:47Z Indexed on 2010/06/16 5:12 UTC
Read the original article Hit count: 331

Filed under:
|

Hi, I've got a problem with the following code

<script type="text/javascript">
var mydata = [ {id:"1",name:"foo"},{id:"2",name:"bar"}  ];

jQuery(document).ready(function() {
jQuery("#lgrid").jqGrid({ data: mydata, 
                    datatype: "local", 
                    height: 150, 
                    width:600,
                    rowNum: 10, 
                    rowList: [10,20,30], 
                    colNames:['id','name'], 
                    colModel:[  {name:'id',index:'id', width:60, sorttype:"int"},
                                {name:'name',index:'name', width:60}], 
                    pager: "#pgrid", 
                    viewrecords: true, 
                    caption: "Contacts" });

});

</script>

And In the body ....

<table id="lgrid"></table>
<div id="pgrid"></div>

With this code, I never display the data into the grid. Somebody has an idea about this issue ?
Thanks.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jqgrid