开发者

Problem Getting jqgrid to show data on a c# webform

I have been struggling all day to get data to show in a jqgrid. Then grid displays ok, but there is no data in it, i've no idea why the data is missing. This is the response from the web page i am trying to load

{total: "1",page: "1",records: "2",rows : [{id:"1", "cell":["Test1", "1234", "Info"]},{id:"2", "cell":["Test2", "5678", "Info"]}]}

And this is the code to load the info in:

    <link rel="stylesheet" type="text/css" media="screen" href="css/ui.jqgrid.css" />
<link rel="stylesheet" type="text/css" media="screen" href="css/jquery-ui-1.7.2.custom.css" />

<script src="Scripts/jquery-1.4.2.min.js" type="text/javascript"></script>
<script src="Scripts/grid.locale-en.js" type="text/javascript"></script>
<script src="Scripts/jquery-ui-1.7.2.custom.min.js" type="text/javascript"></script>
<script src="Scripts/jquery.jqGrid.min.js" type="text/javascript"></script>
<script src="Scripts/json2-min.js" type="text/javascript"></script>

<script type="text/javascript">

//JS for the main history grid
jQuery(document).ready(function () {
    jQuery("#datalist").jqGrid({
        url: 'Data1.aspx',
        datatype: 'json',
        colNames: [
              'Type'
             , 'URN'
             , 'Log'],
        colModel: [{ name: 'id', index: 'id', sorttype: "int", width: 35 },
       { name: 'type', index: 'type', width: 45, align: "center" },           
     开发者_开发知识库  { name: 'log', index: 'log', width: 35, align: "center"}],
        height: 400,
        width: 1165,           
        shrinkToFit: true,
        caption: "Job History",
        viewrecords: true,
        sortorder: "desc"            
    })      
});

Is the format of my json response wrong, am i missing something from my grid? It's really starting to bug me now!

Thanks Luke


See the comment on the post, i was missing quotes round the keys at the start

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜