EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: dion on November 20, 2014, 12:47:07 AM



Title: Accordion panel header text
Post by: dion on November 20, 2014, 12:47:07 AM
Hi,

How do I do the following, but instead of returning the panelIndex, I need the panel header text

var p = $('#aa').accordion('getSelected');
if (p){
   var index = $('#aa').accordion('getPanelIndex', p);
   alert(index);
}

Regards,
Dion


Title: Re: Accordion panel header text
Post by: stworthy on November 20, 2014, 01:03:27 AM
Once you get the panel object, you can get all the options by calling the 'options' method.
Code:
var p = $('#aa').accordion('getSelected');
if (p){
  var title = p.panel('options').title;
  alert(title);
}


Title: Re: Accordion panel header text
Post by: dion on November 20, 2014, 01:46:13 AM
Thanks for the prompt reply. Where do I get more internal info like "...you can get all the options by calling the 'options' method". Do I need to do jQuery tutorials(as yet, my repertoire does not include much java, but I see and understand the object orientation.) I end up trying to guess some of the properties and methods. I have looked at the documentation, and I am either blind or this info was not there.

Cheers.


Title: Re: Accordion panel header text
Post by: phunksta on November 20, 2014, 04:15:33 AM
I end up trying to guess some of the properties and methods. I have looked at the documentation, and I am either blind or this info was not there.

Hi, I admit it takes a while, but the documentation does have this stuff. After staring at it over a few weeks it started to make a lot more sense.
I have also found it useful to actually go into the easyui code in some places, especially to see when event handlers are called.

I too started with very little javascript and jQuery but I'm getting it slowly! I still need stworthy to point out the best way quite often though!


Title: Re: Accordion panel header text
Post by: dion on November 20, 2014, 08:21:15 AM
Thanks.