I use ExtJS 1.0.1 (in magento)
I would like to get all checked nodes on form submit. And I stucked here:
tree.html (initialization):
tree<?php echo $this->getId() ?> = new Ext.tree.TreePanel.Enhanced('<?php echo $_divId ?>', {
animate: false,
loader: categoryLoader,
enableDD: false,
containerScroll: true,
rootVisible: '<?php echo $this->getRoot()->getIsVisible() ?>',
useAjax: true,
currentNodeId: <?php echo (int) $this->getCategoryId() ?>,
addNodeTo: false
});
On submit function:
function submit()
{
console.log(tree'.$this->getId().');
// got html code <div id="treeoptions_fieldset992cb0dd9a7da511e5596a229a5386d5_select_catalogb0f2cd4faa4f13b72f0df314bdc222ec" class="tree x-tree"><ul class="x-tree-root-ct x-tree-lines" id="ext-gen5859">...</ul></div>
var checked_nodes = tree'.$this->getId().'.getChecked();
// got an error Uncaught TypeError: Object #<HTMLDivElement> has no method 'getChecked'
}
Magento uses prototypeJS in admin panel. The question is how to address to checked_nodes to run getChecked()?
get works!
I created the object after treegetId() ?> init:
function av_OkButton()
{
var tree = null;
this.onPress = function()
{
var ids = this.tree.getChecked();
}
this.getTree = function()
{
return this.tree;
}
this.setTree = function(treeObj)
{
this.tree = treeObj;
return this;
}
}
okButton = new av_OkButton;
okButton.setTree(tree<?php echo $this->getId() ?>);
And then created submit button:
Cannot understand what the difference between I did and what I have now but it works for me