EasyUI Forum
September 14, 2025, 06:59:26 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: Looping reload in collapsible datagrid (bug?)  (Read 6818 times)
aswzen
Sr. Member
****
Posts: 287


Indonesian

aswzen
View Profile WWW Email
« on: March 23, 2015, 07:57:12 PM »

I have some problem here,

I want to make the datagrid collapsed if the datagrid rows is not empty..i can achieve it manually with this code below

Code:
$('#dg').datagrid({collapsed:true});

now i want to make it automatic collapsed, i try to put it on onLoadSuccess listener in datagrid so like the code below

Code:
onLoadSuccess:function(data){
if(data.total != 0){
$(this).datagrid({collapsed:true});
}
}

but what happen next is disaster, the page / datagrid always reload everytime and never stopped and then the browser crash

already tried to use
Code:
		$(this).datagrid('collapse');
$(this).panel('collapse');
but have no result

here the fiddle, change the if(data.total == 0){ to if(data.total != 0){ and press RUN button in top left . be carefull this will crash your browser
http://jsfiddle.net/aswzen/bgy4kg2k/3/

any suggestion ?

thanks in advance
« Last Edit: March 23, 2015, 08:28:32 PM by aswzen » Logged

Regards,
Sigit

- Indonesian jEasyUI Facebook page : https://www.facebook.com/groups/jeasyuiid/
jarry
Administrator
Hero Member
*****
Posts: 2298


View Profile Email
« Reply #1 on: March 24, 2015, 12:27:53 AM »

The datagrid has not 'collapse' method. You have to call 'getPanel' method to get the panel object before calling this method. Please use the code below instead.
Code:
onLoadSuccess:function(data){
if(data.total != 0){
$(this).datagrid('getPanel').panel('collapse');
}
}
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!