EasyUI Forum
June 26, 2024, 12:41:51 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: The fixDetailRowHeight property setting when subgrid is nested  (Read 6718 times)
officecode
Jr. Member
**
Posts: 69


View Profile Email
« on: January 21, 2019, 04:26:25 AM »

Look at the sample code:

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!
« Last Edit: January 21, 2019, 06:09:54 AM by officecode » Logged
jarry
Administrator
Hero Member
*****
Posts: 2267


View Profile Email
« Reply #1 on: January 21, 2019, 05:55:50 AM »

Please try to define an 'expander' column for all the master datagrid components.
Code:
columns:[[
  {field:'e',expander:true,width:40},
  {field:'itemid',title:'Item ID',width:80},
  ...
Logged
officecode
Jr. Member
**
Posts: 69


View Profile Email
« Reply #2 on: January 21, 2019, 06:13:14 AM »

Try adding the 'expander' column, it doesn't work. Sad
« Last Edit: January 21, 2019, 06:15:56 AM by officecode » Logged
jarry
Administrator
Hero Member
*****
Posts: 2267


View Profile Email
« Reply #3 on: January 21, 2019, 06:01:50 PM »

Please show your code to demostrate your issue.
Logged
officecode
Jr. Member
**
Posts: 69


View Profile Email
« Reply #4 on: January 21, 2019, 08:41:41 PM »

Please show your code to demostrate your issue.

This is the complete code:

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
Logged
jarry
Administrator
Hero Member
*****
Posts: 2267


View Profile Email
« Reply #5 on: January 21, 2019, 11:15:56 PM »

All the subgrid components should also have the expander column.
Logged
battlezad
Newbie
*
Posts: 44


View Profile
« Reply #6 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:

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
Logged
officecode
Jr. Member
**
Posts: 69


View Profile Email
« Reply #7 on: January 22, 2019, 02:21:59 AM »

It is indeed an error of 'expandder'. Embarrassed
The problem is solved, thank you very much.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!