EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: brettjw on October 18, 2013, 09:22:40 AM



Title: Show/Hide expander in DataGrid
Post by: brettjw on October 18, 2013, 09:22:40 AM
I was wondering if anyone has been able to make this work? I need to be able to show or hide the expander based on a value in the data source. So if the value of data.Count = 0 then I want to hide the expander. I have tried using the loadFilter param, but was unsuccessful. There was a posting about hiding it for specific rows, but I need to be able to use a value from the data for the each row to determine if it is shown or hidden. Any help would be very much appreciated.

Thanks

Brettjw


Title: Re: Show/Hide expander in DataGrid
Post by: stworthy on October 18, 2013, 07:27:38 PM
Suppose each rows have 'count' property to determine if to show the expander icon or not. The code below shows how to achieve this functionality.
Code:
$('#dg').datagrid({
onLoadSuccess:function(data){
for(var i=0; i<data.rows.length; i++){
if (data.rows[i].count == 0){
$(this).datagrid('getExpander', i).hide();
}
}
}
});


Title: Re: Show/Hide expander in DataGrid
Post by: brettjw on October 20, 2013, 05:39:09 PM
Once again that worked perfectly - Thanks a ton!

Brett


Title: Re: Show/Hide expander in DataGrid
Post by: aswzen on September 29, 2015, 02:04:49 AM
if there are no rows matches with the condition the datagrid will appear oodly like below..

(http://i.imgur.com/iPNgSb6.jpg)