javascript - Error adding and removing content to tabPanels - ExtJs -
i have web app built using extjs framework.
i have tree in west panel, , in center panel tabpanel. when click on of nodes on tree in west panel attempts add form on center tabpanel, following code called:
var center = ext.getcmp("center-panel"); var existingpanel = center.get(panelid); if (existingpanel) { center.setactivetab(existingpanel); } else { var activetab = center.getactivetab(); if (!opennew && activetab) { var removed = center.remove(activetab, true); } center.add(c); center.setactivetab(panelid); center.dolayout(); }
this retrieves current component, , checks see if tab attempting load exists, if exist activates tab, otherwise attempt add new one. opennew s flag passed in state whether should opened in new tab (for example if user ctrl+clicks node on tree).
without using opennew functionality (e.g. 1 tab) form works correctly, , can navigate between nodes tabs being removed/re-added correctly.
however, if ctrl+click node open second tab, tab opens @ first, there 2 tabs, when select node (so should remove added second tab , replace new tab new node) closes second tab fails add new tab.
i can't see reason behind fien adding/removing tabs when there single tab.
there error in firebug, doesn't offer help:
uncaught exception: [exception... "could not convert javascript argument arg 0 [nsidom3node.comparedocumentposition]" nsresult: "0x80570009 (ns_error_xpc_bad_convert_js)" location: "js frame :: /ext/ext-3.1.1/adapter/ext/ext-base-debug.js?d=1066331810 :: <top_level> :: line 1900" data: no]
-----------update:--------------
it seems correlate dolayout() call - if put dolayout() call directly after remove() call, doesnt fat add() call, , if put after .add() call half loads new tab stops before completing.
if have dolayout() call after both, works little better, , can have 2 functioning tabs, when tried add third tab displays same behaviour above, , closes third tab , doesnt repopen new one..
i have resolved issue - problem formpanels adding, whilst panels had unique ids had not thought check ids of other components within form (as jad suggests in comments), , forms had "fieldsets" defined static ids, removing resolved problems.
i tested problem in chrome using developer tools , found stack trace provided lot more useful error provided firebug, using both on!
Comments
Post a Comment