Note that there are some explanatory texts on larger screens.

plurals
  1. POPopulating jqGrid with JSON return data and getting Uncaught TypeError Cannot read property '0' of undefined
    primarykey
    data
    text
    <p>I'm trying to return some JSON from my Spring webapp using Jackson and parse it and load it into a jqGrid.</p> <p>I've got the data coming back and visible in Chrome via the JSONViewer extension. It looks correct to me.</p> <p>Local tests with arraydata have been successful.</p> <p>Here's my JSP/HTML/JS:</p> <pre><code> &lt;link rel='stylesheet' type='text/css' href='http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/themes/ui-darkness/jquery-ui.css' /&gt; &lt;link rel='stylesheet' type='text/css' href='css/jqGrid/ui.jqgrid.css' /&gt; &lt;script type='text/javascript' src='js/jquery-1.7.1.min.js'&gt;&lt;/script&gt; &lt;script type='text/javascript' src='js/jquery-ui-1.8.17.custom.min.js'&gt;&lt;/script&gt; &lt;script type='text/javascript' src='js/i18n/grid.locale-en.js'&gt;&lt;/script&gt; &lt;script type='text/javascript' src='js/jquery.jqGrid.min.js'&gt;&lt;/script&gt; &lt;script type='text/javascript'&gt; $(document).ready(function () { jQuery("#list").jqGrid({ url:"formSubmit.html", datatype: "json", height: 700, width: 1100, colNames: ['ReqID', 'Family', 'ControlID', 'Name', 'Description', 'Category','Priority', 'Notes', 'Parent'], colModel: [ { name: 'reqID', index: 'reqID', width: 40 }, { name: 'family', index: 'family', width: 100 }, { name: 'controlID', index: 'controlID', width: 100 }, { name: 'reqName', index: 'reqName', width: 175 }, { name: 'requirement', index: 'requirement', width: 450,cellattr: function (rowId, tv, rawObject, cm, rdata) { return 'style="white-space: normal;"' } }, { name: 'category', index: 'category', width: 100 }, { name: 'priority', index: 'priority', width: 100 }, { name: 'requirementNotes', index: 'requirementNotes', width: 100 }, { name: 'parent', index: 'parent', width: 100 } ], rowNum: 10, rowList: [10, 20, 30], pager: '#pager', viewrecords: true, jsonReader : { repeatitems: false } }); jQuery("#list").jqGrid('navGrid', '#pager', { edit: false, add: false, del: false }); }); &lt;/script&gt; &lt;table id = 'list'&gt;&lt;/table&gt; </code></pre> <p>Here's some data coming back from my Spring container using Jackson:</p> <pre><code>{ "total":"1", "page":"1", "records":"558", "rows":[{ "parent":"", "priority":"", "requirementNotes":"DummyData", "category":"DummyData", "family":"DummyData", "requirement":"DummyData", "reqID":"1", "controlID":"DummyData", "reqName":"DummyData"}] } </code></pre> <p>I'm consistently getting back an Uncaught TypeError cannot read property '0' in undefined as my response in jquery.jqGrid.min.js:23 and I'm stumped.</p>
    singulars
    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.
 

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