EasyUI Forum
May 17, 2024, 11:37:36 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: Show/Hide expander in DataGrid  (Read 10231 times)
brettjw
Newbie
*
Posts: 4


View Profile
« 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
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 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();
}
}
}
});
Logged
brettjw
Newbie
*
Posts: 4


View Profile
« Reply #2 on: October 20, 2013, 05:39:09 PM »

Once again that worked perfectly - Thanks a ton!

Brett
Logged
aswzen
Sr. Member
****
Posts: 287


Indonesian

aswzen
View Profile WWW Email
« Reply #3 on: September 29, 2015, 02:04:49 AM »

if there are no rows matches with the condition the datagrid will appear oodly like below..

Logged

Regards,
Sigit

- Indonesian jEasyUI Facebook page : https://www.facebook.com/groups/jeasyuiid/
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!