EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: stephenl on June 02, 2019, 04:24:31 AM



Title: Nested Subgrid - 2nd level
Post by: stephenl on June 02, 2019, 04:24:31 AM
Hello

The code below returns the JSON data for the 2nd level of a nested grid using url:'get_notes.php', however the respective fields on the grid are not being populated. (The subgrid header is showing OK)

Where am I going wrong ?


        <script type="text/javascript">
        var conf = {
         
            options:{
                fitColumns:true,
                columns:[[
                    {field:'Customer',title:'Acct',width:10},
                    {field:'Cus_Name',title:'Name',width:100},
                ]],
            },
         
            subgrid:{
                options:{
                    fitColumns:true,
               singleSelect:true,
               url:'get_docs.php',
                    foreignField:'Customer',
                            columns:[[
                                {field:'Doc',title:'Doc',width:6},
                        {field:'Doc_Type',title:'T',width:3,align:'center'},
                        {field:'Doc_Date',title:'Doc Date',width:10,align:'center'},
                        {field:'Due',title:'Due Date',width:10,align:'center'},
                            ]],
            },      
            
              subgrid:{
                    options:{
                    fitColumns:true,
               singleSelect:true,
               url:'get_notes.php',
                    foreignField:'Doc',
                            columns:[[
            {field:'Doc',title:'Doc',width:20},
                                {field:'Notedate',title:'Date',width:30},
                                {field:'Note',title:'Note',width:200},
                            ]]
                   }
      }
              }   
                  
       };
 
        $(function(){
            $('#dg').datagrid({
                title:'Accounts',
                width:850,
                height:450
            }).datagrid('subgrid', conf);
        });
        </script>

Thank you


Title: Re: Nested Subgrid - 2nd level
Post by: stephenl on June 03, 2019, 01:31:35 PM
Hello

I have noticed the following error, when expanding the 2nd level.....maybe this helps identify my problem

TypeError: rows is undefinedjquery.easyui.min.js:12284:13

    jQuery 14
        renderTable
        render
        _79d
        loadData
        each
        each
        loadData
        datagrid
        _882
        success
        i
        fireWith
        y
        c

Any suggestions would be appreciated

Thank you





Title: Re: Nested Subgrid - 2nd level
Post by: jarry on June 03, 2019, 06:42:43 PM
Please look at this example http://code.reloado.com/udemuz3/edit#preview


Title: Re: Nested Subgrid - 2nd level
Post by: stephenl on June 04, 2019, 12:02:18 PM
Hi Jarry

Thank you taking the time to reply, and confirming my code was in fact OK, this prompted me to look elsewhere...

The actual problem was the [] were missing from the returned Json data !..

Thanks again !