view - ExtJS 4.2.1, treepanel disappearing -
i working extjs 4.2.1
i have button make appear panel.
this panel containing treepanel, 5 checkboxes below, , 1 valid button (to close treepanel , valid fact checked nodes) , 1 cancel button (just cose treepanel).
i can make panel appear , works fine. if click on cancel or valid button, panel hide (ok), , next time try show it doesn't contain treepanel anymore, 5 checkboxes , 2 buttons (attention, 2 panels different, panel containing treepanel).
i don't understand because there no reason disappear. when check treepanel console.log()
can see, passing treepanel.store.tree.root
treepanel still exists , filled. when pass through treepanel.view.all
can see right elements present in view. when check treepanel.body.dom
chrome debugging can't see element (ordinary when pass on dom mouse on chrome debugging can see corresponding part of page colored).
here concerned part of code:
var button = ext.get('productselectionbutton'); var treeselector = createtree('staddaction.do?action=product_tree_selector', 550, 490, '', 'lbl_st_tree_selection_empty', true, 'productlist'); button.on('click', function(){ treeselector.store.proxy.url = 'staddaction.do?action=product_tree_selector'; treeselector.store.reload(); var productpanel = ext.create('ext.formpanel',{ fielddefaults:{ labelwidth: 75 // label settings here cascade unless overridden }, frame:true, title: document.getelementbyid('applicability').innerhtml + ' - ' + document.getelementbyid('lbl_st_product_tree_win').innerhtml, style:'padding: 5px 5px 0; margin-top: 0;', width: 550, items: [treeselector, { xtype: 'checkboxgroup', items: [ {boxlabel: document.getelementbyid('lbl_status_deleted').innerhtml, name: 'status_2', checked: false, ctcls:'check-status-2', listeners: { change: function(newvalue, oldvalue, eopts ){ if(newvalue.checked){ // show items status 2 deleted status ext.array.remove(statustohide, "2"); productlist.showidsstatus(2); } else{ // hide items status 2 deleted status ext.array.push(statustohide, "2"); productlist.hideidsstatus(2); } } }, ... 4 others checkboxes }], buttons: [{ icon : 'img/st_little_valid.png', style:'width:20px!important;', handler: function(){ var data = '', selnodes = treeselector.getcheckednodes(treeselector.getrootnode()); precedentlycheckednodes = selnodes; xhr = getxhr(); xhr.onreadystatechange = function(){ if (xhr.readystate == 4 && xhr.status == 200) { var myload = eval(mydatagrid); productgrid.store.loaddata(myload); productgrid.getview().refresh(); win.hide(); enablesave(); } } var params = "action=set_iceproduct&datatoadd=" + data + "&datatoremove=" + strunchecked; xhr.open("post", "staddaction.do", true); xhr.setrequestheader('content-type', 'application/x-www-form-urlencoded'); xhr.setrequestheader('content-length', params.length); xhr.send(params); } }, { icon : 'img/st_little_cancel.png', handler: function(){ /* restore nodes how before (checked or unchecked) */ treeselector.verifycheckednodes(precedentlycheckednodes); win.hide(); /* expand first level */ treeselector.collapseall(); treeselector.getrootnode().expand(); } }] });
i don't know if quite explicit... anyway, idea welcomed! how can treepanel disappear panel , still exist!
thank you
you calling ext.create
in buttons click event function every time. means first time create it, it's okay. when click button again, create panel same configuration, can't have treeselector in both because somewhere else. change code like:
var button = ext.get('productselectionbutton'); var treeselector = createtree('staddaction.do?action=product_tree_selector', 550, 490, '', 'lbl_st_tree_selection_empty', true, 'productlist'); button.on('click', function(button){ treeselector.store.proxy.url = 'staddaction.do?action=product_tree_selector'; treeselector.store.reload(); if(!button.productpanel) { button.productpanel = ext.create('ext.formpanel',{ fielddefaults:{ labelwidth: 75 // label settings here cascade unless overridden }, frame:true, title: document.getelementbyid('applicability').innerhtml + ' - ' + document.getelementbyid('lbl_st_product_tree_win').innerhtml, style:'padding: 5px 5px 0; margin-top: 0;', width: 550, items: [ treeselector, { xtype: 'checkboxgroup', items: [ {boxlabel: document.getelementbyid('lbl_status_deleted').innerhtml, name: 'status_2', checked: false, ctcls:'check-status-2', listeners: { change: function(newvalue, oldvalue, eopts ){ if(newvalue.checked){ // show items status 2 deleted status ext.array.remove(statustohide, "2"); productlist.showidsstatus(2); } else{ // hide items status 2 deleted status ext.array.push(statustohide, "2"); productlist.hideidsstatus(2); } }
Comments
Post a Comment