EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: stephenl on December 24, 2018, 03:52:11 AM



Title: Return Data From Selected Line of a Subgrid
Post by: stephenl on December 24, 2018, 03:52:11 AM
Hello

I am trying to return data from a subgrid based upon the examples provided, however the data is not being returned. I am however able to return data from the top level grid, therefore i think my selection code must be incorrect


select function

      function getSelected(){
         var row = $('#tt').datagrid('getSelected');
         if (row){
            alert('Name:'+row.Name+"\nAddress:"+row.Address+"\nTelephone:"+row.Tel);
         }
      }

subgrid function

            $(function(){
                $('#dg').datagrid({
                    view: detailview,
                    detailFormatter:function(index,row){
                        return '<div style="padding:2px;position:relative;"><table class="ddv"></table></div>';
                    },
                    onExpandRow: function(index,row){
                        var ddv = $(this).datagrid('getRowDetail',index).find('table.ddv');
                        ddv.datagrid({
                            url:'get_name.php?name='+row.Name,
                            fitColumns:true,
                            singleSelect:true,
                            rownumbers:true,
                     striped:true,
                            loadMsg:'',
                            height:'auto',
                            columns:[[
                                {field:'Name',title:'Name',width:10},
                                {field:'Address',title:'Address',width:10,align:'center'},
                        {field:'Tel',title:'Telephone',width:10,align:'center'}
                     ]],   
                            onResize:function(){
                                $('#dg').datagrid('fixDetailRowHeight',index);
                            },
                            onLoadSuccess:function(){
                                setTimeout(function(){
                                    $('#dg').datagrid('fixDetailRowHeight',index);
                                },0);
                            }
                        });
                        $('#dg').datagrid('fixDetailRowHeight',index);
                    }
                });
            });

Suggestions appreciated
Thank you