EasyUI Forum
May 16, 2024, 04:37:36 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Accordion: change title text on Collapse and  (Read 10894 times)
kudoof
Newbie
*
Posts: 21


View Profile
« on: August 14, 2013, 08:01:04 AM »

Searched but did not find similar questions.   I found onCollapse event listed in the Panel events so I assume it is inherited in Accordion.  However I tried the following with no luck:

Code:
$('#spouse_info').accordion({
border: false,
onCollapse: function(title){
$('#spouse_info').accordion('setTitle',"Click to expand");
}
});

Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: August 14, 2013, 06:49:55 PM »

The 'onCollapse' is one of panel events. It need to be applied on the panel component. Call 'getPanel' method of accordion to get a panel and attach the 'onCollapse' event to it.

Code:
var p = $('#aa').accordion('getPanel',1);  // get the second panel
var opts = p.panel('options');
var onCollapse = opts.onCollapse;
opts.onCollapse = function(){
$(this).panel('setTitle', 'Click to expand');
onCollapse.call(this);
}
Logged
kudoof
Newbie
*
Posts: 21


View Profile
« Reply #2 on: August 14, 2013, 11:11:00 PM »

Worked!  Also added onExpand the same way.  Thanks a lot!

Another question here: how to set one panel to be uncollapsible, either at initialization or the user wants to 'anchor' it
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!