Note that there are some explanatory texts on larger screens.

plurals
  1. POProblem showing jqgrid with dynamic column binding
    primarykey
    data
    text
    <p>I am trying to pass the colModel and columns from struts action. Just like in the question <a href="https://stackoverflow.com/questions/2277962/jqgrid-and-dynamic-column-binding">jqGrid and dynamic column binding</a></p> <p>I am not sure what I am missing. Please Help. Spent quite some time trying to get it right.</p> <p>jsp:</p> <pre><code> &lt;script type="text/javascript"&gt; $(document).ready(function(){ $.ajax( { type: "POST", url: "interFinalTbaAction.action", data: "", dataType: "json", success: function(result){ colD = result.couponStripList; colN = result.columnNames; colM = result.colModelList; jQuery("#dataGrid").jqGrid({ jsonReader : { repeatitems: false, root:"rootVar", cell: "", id: "0" }, url: 'SomeUrl/Getdata', datatype: 'jsonstring', mtype: 'POST', datastr : colD, colNames:colN, colModel :colM, loadComplete: function(data){alert('loaded');}, loadError: function(xhr,status,error){ alert('error'); } }) }, error: function(x, e){ alert(x.readyState + " "+ x.status +" "+ e.msg); } }); }); &lt;/script&gt; &lt;h2&gt;Inter Final Prices&lt;/h2&gt; &lt;table id="dataGrid"&gt; &lt;/table&gt; &lt;/html&gt; </code></pre> <p>The JSON that my action retuns is </p> <pre><code> { "colModelList": [ { "index": "prceCM", "jsonmap": null, "key": false, "name": "prceCM", "resizeable": true, "search": true, "sortable": false, "title": "03-01-11", "width": 300 }, { "index": "prceCMPlusOne", "jsonmap": null, "key": false, "name": "prceCMPlusOne", "resizeable": true, "search": true, "sortable": false, "title": "04-01-11", "width": 300 }, { "index": "prceCMPlusTwo", "jsonmap": null, "key": false, "name": "prceCMPlusTwo", "resizeable": true, "search": true, "sortable": false, "title": "05-01-11", "width": 300 }, { "index": "prceCMPlusThree", "jsonmap": null, "key": false, "name": "prceCMPlusThree", "resizeable": true, "search": true, "sortable": false, "title": "06-01-11", "width": 300 }, { "index": "coupon", "jsonmap": null, "key": false, "name": "coupon", "resizeable": true, "search": true, "sortable": false, "title": null, "width": 300 } ], "columnNames": [ "prceCM", "prceCMPlusOne", "prceCMPlusTwo", "prceCMPlusThree", "coupon" ], "couponStripList": { "rootVar": [ { "coupon": 5.0, "prceCM": "Not Available", "prceCMPlusOne": "Not Available", "prceCMPlusThree": "Not Available", "prceCMPlusTwo": "Not Available" }, { "coupon": 5.5, "prceCM": "Not Available", "prceCMPlusOne": "Not Available", "prceCMPlusThree": "Not Available", "prceCMPlusTwo": "Not Available" }, { "coupon": 6.0, "prceCM": "Not Available", "prceCMPlusOne": "Not Available", "prceCMPlusThree": "Not Available", "prceCMPlusTwo": "Not Available" }, { "coupon": 6.5, "prceCM": "Not Available", "prceCMPlusOne": "Not Available", "prceCMPlusThree": "Not Available", "prceCMPlusTwo": "Not Available" }, { "coupon": 7.0, "prceCM": "Not Available", "prceCMPlusOne": "Not Available", "prceCMPlusThree": "Not Available", "prceCMPlusTwo": "Not Available" } ] }, "deliveredDataTimestamp": null, "requestedTimestamp": null } </code></pre> <p>Thanks.</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