EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: roberto on August 09, 2017, 07:52:07 PM



Title: accordion onselect/onunselect
Post by: roberto on August 09, 2017, 07:52:07 PM
hi,
I have an accordion control. I don't want to let the user close all panels. If he close the last one I want to select the next or the previous, but I can't find how to know if the unselected panel is the last opened.
Is it possible?
tks,


Title: Re: accordion onselect/onunselect
Post by: jarry on August 11, 2017, 12:15:50 AM
You can call 'panels' method to get all the accordion panels. Retrieve the 'collapsed' property of a panel to check if the panel is collapsed.
Code:
var panels = $('#aa').accordion('panels');
for(var i=0; i<panels.length; i++){
  var p = panels[i];
  var collapsed = p.panel('options').collapsed;
  console.log(collapsed)
}