EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: hjzhbb7758 on May 19, 2013, 08:28:32 AM



Title: Easyui datagrid groupview
Post by: hjzhbb7758 on May 19, 2013, 08:28:32 AM
中文  : Easyui datagrid groupview 如何控制单击如图地方,触发展开

English : Easyui datagrid groupview . How to control click Figure triggered expand


Title: Re: Easyui datagrid groupview
Post by: hjzhbb7758 on May 21, 2013, 02:39:33 AM
anybody here ? everyone can answer my question


Title: Re: Easyui datagrid groupview
Post by: stworthy on May 21, 2013, 03:07:54 AM
Try code below:
Code:
$('#dg').datagrid({
view:groupview,
onLoadSuccess:function(){
var dg = $(this);
dg.datagrid('getPanel').find('div.datagrid-view2 div.datagrid-group').unbind().bind('click',function(){
var index = $(this).attr('group-index');
dg.datagrid('expandGroup', index);
});
}
});


Title: Re: Easyui datagrid groupview
Post by: cp_Burn on May 21, 2013, 09:24:16 AM
You can do something with onExpandRow:

Code:
$(function(){	
$('#dg').datagrid({
view: detailview,
onExpandRow: function(index,row){
                                                //What you want to do after click in the figure
alert('Hey there =p');
}
});
}


Title: Re: Easyui datagrid groupview
Post by: hjzhbb7758 on May 22, 2013, 01:51:50 AM
You can do something with onExpandRow:

Code:
$(function(){	
$('#dg').datagrid({
view: detailview,
onExpandRow: function(index,row){
                                                //What you want to do after click in the figure
alert('Hey there =p');
}
});
}

group view, you see?


Title: Re: Easyui datagrid groupview
Post by: hjzhbb7758 on May 22, 2013, 03:50:11 AM
Try code below:
Code:
$('#dg').datagrid({
view:groupview,
onLoadSuccess:function(){
var dg = $(this);
dg.datagrid('getPanel').find('div.datagrid-view2 div.datagrid-group').unbind().bind('click',function(){
var index = $(this).attr('group-index');
dg.datagrid('expandGroup', index);
});
}
});

onLoadSuccess:function(){
var dg = $(this);
dg.datagrid('getPanel').find('div.datagrid-view2 div.datagrid-group').unbind().bind('click',function(){
var index = $(this).attr('group-index');
var group = dg.datagrid('getPanel').find('div.datagrid-group[group-index="'+index+'"]');
var expander = group.find('span.datagrid-row-expander');
if (expander.hasClass('datagrid-row-expand')){
dg.datagrid('expandGroup', index);
}else{
dg.datagrid('collapseGroup', index);
}
});

thanks for your help .