Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You don't posted the full code which you use. So I can only guess what you do.</p> <p>If you have in <code>ajaxResponse</code> the full data which you use to fill the grid you can <em>create</em> the grid with data. You can use <code>data: ajaxResponse</code> together with <code>gridview: true</code>. In the case the whole grid will be created at once:</p> <pre><code>var mydata = [ {id: 1, name: 'John', email: 'john@doe.co.uk'}, {id: 2, name: 'Michael', email: 'michael@example.com'} ]; $("#list").jqGrid({ datatype: 'local', data: mydata, colNames: ['Name', 'E-Mail'], colModel: [ {name: 'name', width: 100}, {name: 'email', width: 150} ], rowNum: 5, rowList: [5, 10, 20], pager: '#pager', gridview: true, rownumbers: true, sortname: 'name', sortorder: 'desc', caption: 'Just simple local grid', height: 'auto' }); </code></pre> <p>(see the demo <a href="http://www.ok-soft-gmbh.com/jqGrid/Nicolae1.htm" rel="nofollow">here</a>)</p> <p>If you get the data from the server in JSON format like this</p> <pre><code>[ {"id": 1, "name": "John", "email": "john@doe.co.uk"}, {"id": 2, "name": "Michael", "email": "michael@example.com"} ] </code></pre> <p>you can set <code>url</code> parameter to the server URL which provide the data and use</p> <pre><code>$("#list").jqGrid({ url: 'Nicolae2.json', datatype: 'json', jsonReader: { repeatitems: false, root: function (obj) { return obj; }, page: function () { return 1; }, total: function () { return 1; }, records: function (obj) { return obj.length; } }, loadonce: true, colNames: ['Name', 'E-Mail'], colModel: [ {name: 'name', width: 100}, {name: 'email', width: 150} ], rowNum: 5, rowList: [5, 10, 20], pager: '#pager', gridview: true, rownumbers: true, sortname: 'name', sortorder: 'asc', caption: 'Just simple local grid', height: 'auto' }); </code></pre> <p>to fill the grid per Ajax <em>directly</em> from the server. The only restriction that you have to provide correct sorted data. So I changed the <code>sortorder: 'desc'</code> from the previous example to <code>sortorder: 'asc'</code>. See the second demo <a href="http://www.ok-soft-gmbh.com/jqGrid/Nicolae2.htm" rel="nofollow">here</a>.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload