Title: The fixDetailRowHeight property setting when subgrid is nested
Post by: officecode on January 21, 2019, 04:26:25 AM
Look at the sample code: var dg = { url:'griddata.php', columns:[[...]], pagination:true }; var sub1 = { url:'gydata.php', foreignField:'cp', columns:[[...]], onLoadSuccess: function(param){ var pg = $(this).datagrid('getParentGrid'); var index = $(this).datagrid('getParentRowIndex'); pg.datagrid('fixDetailRowHeight',index); } }; var sub2 = { url:'gydata.php', foreignField:function(prow){ return prow }, columns:[[...]], onLoadSucess: function(){ var pg = $(this).datagrid('getParentGrid'); var index = $(this).datagrid('getParentRowIndex'); pg.datagrid('fixDetailRowHeight',index); index = pg.datagrid('getParentRowIndex'); pg.datagrid('getParentGrid').datagrid('fixDetailRowHeight',index); }, }; $('#test').datagrid().datagrid('subgrid',{ options:dg, subgrid:{ options:sub1, subgrid:{ options:sub2 } } })
After running, the detail row height is not automatically fixed. I have been studying for a long time and I don't know where the problem is. Please help me, thank you!
Title: Re: The fixDetailRowHeight property setting when subgrid is nested
Post by: jarry on January 21, 2019, 05:55:50 AM
Please try to define an 'expander' column for all the master datagrid components. columns:[[ {field:'e',expander:true,width:40}, {field:'itemid',title:'Item ID',width:80}, ...
Title: Re: The fixDetailRowHeight property setting when subgrid is nested
Post by: officecode on January 21, 2019, 06:13:14 AM
Try adding the 'expander' column, it doesn't work. :(
Title: Re: The fixDetailRowHeight property setting when subgrid is nested
Post by: jarry on January 21, 2019, 06:01:50 PM
Please show your code to demostrate your issue.
Title: Re: The fixDetailRowHeight property setting when subgrid is nested
Post by: officecode on January 21, 2019, 08:41:41 PM
Please show your code to demostrate your issue.
This is the complete code: var dg = { //Initial table url:'griddata', columns:[[ {field:'e',expandder:true}, {field:'ck',checkbox:true}, {field:'cp',title:'product',halign:'center'}, {field:'kh',title:'customer',halign:'center'}, {field:'gy',title:'employee',halign:'center'}, {field:'sl',title:'amount',halign:'center',align:'right'}, {field:'dj',title:'price',halign:'center',align:'right'}, {field:'zk',title:'discount',halign:'center',align:'right'}, {field:'je',title:'amount',halign:'center',align:'right'}, {field:'rq',title:'date',align:'center'} ]], pagination:true }; var sub1 = { //Child table 1 url:'gydata', foreignField:'cp', columns:[[ {field:'kh',title:'customer',width:'45%'}, {field:'sl',title:'amount',width:'45%'}, ]], onLoadSuccess: function(param){ var pg = $(this).datagrid('getParentGrid'); var index = $(this).datagrid('getParentRowIndex'); pg.datagrid('fixDetailRowHeight',index); } }; var sub2 = { //Child table 2 url:'gydata', foreignField:'kh', columns:[[ {field:'gy',title:'employee',width:'50%'}, {field:'sl',title:'amount',width:'50%'}, ]], onBeforeLoad:function(param){ var pg = $(this).datagrid('getParentGrid'); var index = pg.datagrid('getParentRowIndex'); var row = pg.datagrid('getParentGrid').datagrid('getRows')[index]; param.fzl = row.cp //Submit fzl parameters to the server at the same time }, onLoadSucess: function(){ var pg = $(this).datagrid('getParentGrid'); var index = $(this).datagrid('getParentRowIndex'); pg.datagrid('fixDetailRowHeight',index); index = pg.datagrid('getParentRowIndex'); pg.datagrid('getParentGrid').datagrid('fixDetailRowHeight',index); }, }; $('#test').datagrid().datagrid('subgrid',{ options:dg, subgrid:{ options:sub1, subgrid:{ options:sub2 } } })
I uploaded a few more screenshots. among them: 1, the initial expansion effect 2, the effect of re-expanding after folding 3, the effect of the second sub-table expansion 4, the effect of the second sub-sheet after folding
Title: Re: The fixDetailRowHeight property setting when subgrid is nested
Post by: jarry on January 21, 2019, 11:15:56 PM
All the subgrid components should also have the expander column.
Title: Re: The fixDetailRowHeight property setting when subgrid is nested
Post by: battlezad on January 21, 2019, 11:35:26 PM
You have typo: expandder Please show your code to demostrate your issue.
This is the complete code: var dg = { //Initial table url:'griddata', columns:[[ {field:'e',expandder:true}, {field:'ck',checkbox:true}, {field:'cp',title:'product',halign:'center'}, {field:'kh',title:'customer',halign:'center'}, {field:'gy',title:'employee',halign:'center'}, {field:'sl',title:'amount',halign:'center',align:'right'}, {field:'dj',title:'price',halign:'center',align:'right'}, {field:'zk',title:'discount',halign:'center',align:'right'}, {field:'je',title:'amount',halign:'center',align:'right'}, {field:'rq',title:'date',align:'center'} ]], pagination:true }; var sub1 = { //Child table 1 url:'gydata', foreignField:'cp', columns:[[ {field:'kh',title:'customer',width:'45%'}, {field:'sl',title:'amount',width:'45%'}, ]], onLoadSuccess: function(param){ var pg = $(this).datagrid('getParentGrid'); var index = $(this).datagrid('getParentRowIndex'); pg.datagrid('fixDetailRowHeight',index); } }; var sub2 = { //Child table 2 url:'gydata', foreignField:'kh', columns:[[ {field:'gy',title:'employee',width:'50%'}, {field:'sl',title:'amount',width:'50%'}, ]], onBeforeLoad:function(param){ var pg = $(this).datagrid('getParentGrid'); var index = pg.datagrid('getParentRowIndex'); var row = pg.datagrid('getParentGrid').datagrid('getRows')[index]; param.fzl = row.cp //Submit fzl parameters to the server at the same time }, onLoadSucess: function(){ var pg = $(this).datagrid('getParentGrid'); var index = $(this).datagrid('getParentRowIndex'); pg.datagrid('fixDetailRowHeight',index); index = pg.datagrid('getParentRowIndex'); pg.datagrid('getParentGrid').datagrid('fixDetailRowHeight',index); }, }; $('#test').datagrid().datagrid('subgrid',{ options:dg, subgrid:{ options:sub1, subgrid:{ options:sub2 } } })
I uploaded a few more screenshots. among them: 1, the initial expansion effect 2, the effect of re-expanding after folding 3, the effect of the second sub-table expansion 4, the effect of the second sub-sheet after folding
Title: Re: The fixDetailRowHeight property setting when subgrid is nested
Post by: officecode on January 22, 2019, 02:21:59 AM
It is indeed an error of 'expandder'. :-[ The problem is solved, thank you very much.
|