I have an Ext TreePanel that I am trying to add to a paginated page. We are using Ext 2.2.0.
We have a customized tree that has only two levels. We present 25 elements under the tree itself (root?), But each node element can have an unlimited number of children. I guess these are "leaves." Element nodes use a custom uiProvider , like all child elements.
I added some images for the previous / next page to itemNodeUI and added handlers that update the item node attributes with pageNumber. The DataUrl php file captures these attributes and basically adds a LIMIT to the sql query.
Everything works as it should, except when you click on the next / previous images, the node element collapses. If you expand node, everything will be as it should be, but I need either to remain extended node or to automatically update it after loading. I tried using expand() , fireEvent('expand') , expandChildNodes , as many as nine yards. Nothing.
Here is the function called when the "Previous Page" button is clicked:
onPaginationPrevButtonClick: function(e,t) { var parentEl = Ext.get(t).findParentNode('.x-tree-node-ct', 10, false).previousSibling; var treeNodeId = parentEl.getAttribute('ext:tree-node-id'); var treeNode = this.tree.getNodeById(treeNodeId); var currentPage = parseInt(treeNode.attributes.pageNumber); if (currentPage > 0) { treeNode.attributes.pageNumber = currentPage - 1; } treeNode.getLoader().load(treeNode); }
Another problem I'm experiencing is that the itemNodeUI , which extends TreeNodeUI , is not updated when the above function is called. Thus, the text showing how many results are displayed does not change from the first page. Is there a way to update this node and expand it without reloading the whole tree?
If itβs better or easier for you, I have to do it, I appreciate any input that you have. I am Ext.NEWB, so almost all I do is hack.;)
Edit:
I am almost embarrassed to admit this, but I was completely able to solve the dumping problem using treeNode.reload() instead of the rec load() in the loader itself. Sigh...
treeNode.getLoader().load(treeNode);
should have been:
treeNode.reload();
However, I still need to figure out how to update the node itself so that the text showing the results and the previous / next buttons are displayed correctly. I tried using:
treeNode.parentNode.reload();
... but everything that does updates the whole tree. I just want the itemNode element itself to be updated. Any thoughts?
Thank you very much in advance!