mitchellsimoens / Ext.layout.AccordionLayout

An accordion style layout for Sencha Touch
http://www.simoens.org/Sencha-Projects/demos/
25 stars 9 forks source link

Empty items #2

Open qpi opened 13 years ago

qpi commented 13 years ago

If you don't set any 'items' property, or the 'items' property is empty (set it later), the layout throws an error.

Uncaught TypeError: Cannot read property 'el' of undefined Ext.layout.AccordionLayout.js:313

I checked the code, and the 'items' occured 3 times. I modified the functions in this way:

collapseAll: function() { if (typeof items == 'undefined' || items.length == 0 ) return; //my modification ...... getActiveItem: function() { var me = this; if (typeof me.owner.items == 'undefined' || me.owner.items.length == 0 ) return null; //my modification ...... getExpandHeight: function() { if (typeof items == 'undefined' || items.length == 0 ) return 0; ......

After these modifications, the code seems to work correctly.