Try code below:
$('#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 .