Note that there are some explanatory texts on larger screens.

plurals
  1. POjqgrid subgrids each show all items from the json data
    primarykey
    data
    text
    <p>I've been trying to implement a simple subgrid within jqgrid to show line items for an invoice. I finally got the subgrids to populate but each subgrid is showing the same list of line items, which is actually all of the entries in the data set.</p> <p>I'm not quite sure how to debug this but here are some of my potential ideas-</p> <ul> <li><p>Is it a problem with the way the json store is (not) responding to the GET queries?</p></li> <li><p>Is it because nowhere I define what field within the subgrid data is the "foriegn key" so to speak.</p></li> <li><p>Do I need the subGridUrl to point to json data with only the appropriate data (not every line item)</p></li> </ul> <p>Example JSON for line items: order_id points to the id of the order</p> <pre><code>{ "total": 1, "records": 6, "rows": [ { "description": "PART X", "order_id": 2, "qty": 5, ... more fields ... "id": 1 }, ... more ... ], page: 1 } </code></pre> <p>JSON for main grid items:</p> <pre><code>{ "total": 1, "records": 2, "rows": [ { "order_no": 2, ... more fields ... "id": 2 }, ... more ... ], page:1 } </code></pre> <p>Applicable parts of my jqqrid script:</p> <pre><code>jQuery("#mygrid").jqGrid({ ... cosmetic stuff for main grid ... url: "/my_json_url/", datatype: "json", colNames:['Order',...], colModel:[ {name:'order_no', index:'order_no'}, ... ], jsonReader: { repeatitems:false, root: "rows", page: "page", total: "total", records: "records", cell: "", id: "id", subgrid: {root: "rows", cell:"", repeatitems: false} }, prmNames: {subgridid: "order_id"}, subGrid: true, subGridUrl: "/json_url/to_line_items/", subGridModel: [{ name : ['qty','description'], width: [100,100] }] })navGrid(some options); </code></pre>
    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.
    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