jquery subgrid with json


I am working with jqgrid. i have need to implement subgrid of grid. my code is as follows:

<div class="ww90p">
<!-- class="sheet"--> 
<div class="" >
    <table id="setcols" class="scroll">   </table>
    <div id="psetcols" class="scroll"></div>

    $.extend( {}, jqGrid_normal, {
    url: "/account/chartjson/?{{ query_fragment }}&nd="+new Date().getTime(),
    caption: "&nbsp;",
        {name:'number', width:50, label: "Number", sortable:false },
        {name:'name', width:300, label: "Name", sortable:false },
        {name:'opening_date', label: "Opening Date", width:150, sortable:false },
        {name:'balance', label: "Balance", width: 100, sortable:false,align:'right' }
    pager: '#psetcols',
    sortname: 'number',
    sortorder: "desc",
    multiselect: true,
    viewrecords: true, 
    footerrow : true,
    userDataOnFooter : true,
    subGrid: true,
    subGridUrl :"/account/subgridjson/?{{ query_fragment }}&nd="+new Date().getTime(),
    subGridModel: [
             { name : ['number','name','opening_date','balance'], width : [55,200,80,80] }

The JSON file output for subgrid:

    rows: [
        {type: "4", number: "101", name: '<a href="/ledger/view_by_account?account_id=3">Bank (123456789
)</a>', opening_date: "2009-05-12", balance: "0.000000"}

But the error says:

cur is undefined
[Break on this error] for (var j=0;j<cur.length;j++) {......

I cannot overcome this. If any one can please help me.


I found it easier to dump the built-in subgrid and use their "subgrid-as-grid" example for inserting a brand new grid on the fly:

By : LarrikJ

This video can help you solving your question :)
By: admin