Accordion create event, ui missing panel?
I have an accordion which has the default first open panel on initialization. The create event is providing ui.header but not ui.panel (undefined). According to docs it should be there.
The accordion functions fine otherwise.
- $('#campSessionEditorAccordionDiv').accordion({
- heightStyle : 'content',
- animate : {
- easing : 'easeInExpo',
- duration : 500,
- down : {
- easing : 'easeOutBounce',
- duration: 500
- }
- },
- create: function( event, ui ) {
- console.log('create', ui.panel); // <- undefined
- console.log('create', ui.header);
- },
- beforeActivate: function( event, ui ) {
- console.log('beforeActivate', ui.newPanel);
- console.log('beforeActivate', ui.newHeader);
- }
- });
On a related note - Should beforeActivate be fired when the first panel is opened automagically after initialization? It seems to me that it should be, but it's not. Just because that first panel is being activated programmatically doesn't mean the event shouldn't fire.
The only reason I even need the create event here is to grab that first panel after the accordion is loaded. Each panel contains a complex form and there are up to 30 of them.... I'd rather initialize them widgets (datepicker, etc) only as needed, eg - as each panel is actually activated. That first panel needs the same work done on it as the others so getting a beforeActivate event firing on that would be handy (and appropriate in my not so humble opinion).
As it is, even if/when the create event gives me a valid ui.panel the code in my create event handler will be almost identical to me beforeActivate handler. A "beforeFirstActivate' event would be nice to avoid this, and would also negate me needing to track which panel forms have already been initialized.. but I digress...