how re-expand tree grid node if it is expanded? - extjs

On my treegrid when I expanded tree node if there is not data available(and if I added data into database later) I can't expand this node again. need to refresh page. how can I set it expandable? or how force treegrid node to send request again on expand?

If I understand your question, all you have to do is update node (expanded) data. This can be done as follows:
this.getStore('MyTreeStore').load({ node: someNode});

Related

How to show a selected record in the visible portion of a tree

I have a tree control in a fieldset. Am able to populate the tree fine.
I'm using this command to programmatically select a specific node in the tree:
Ext.getCmp('projectsTree').getSelectable().setSelectedRecord(<node>)
where node is the node I want to select. This command works fine. What's happening is that while the record is selected, it is not in the visible portion of the tree. It can be below the visible portion of the tree and I would have to scroll down to see that it is selected. Does anyone have any tips on how to both select the record and have it show up in the visible portion of the tree.
I've seen recommendations using focusRow or selectPath, but I haven't been able to get that working.

ExtJs (Version 7.4) : Tree Panel -> on Click of each parent node proxy URL gets called from store

I am building a Tree Panel using Extjs.
Trying to load dynamic children data from proxy URL.
Data gets loaded to the Store and also the tree panel gets displayed, but on click of parent node proxy URL gets called again and again and tree gets reloaded.
I have even mentioned the leaf value as true for children and false for the the parent nodes but still the same issue occurs.
Also I have given expanded:false for root node but still it gets automatically expanded.
Can anyone please help me with this issue?

Disabling selection of a node in ExtJS tree panel if the node is not a leaf node

I am using ExtJs 4.1 TreePanel control & want to disable selection of a node if that node is not a leaf node. Do we have any property out of the box to achieve this?
So If the node is not a leaf node, disable selection and if user click on that node, system should not fire any event (itemClick or select etc).
Thank you
There's no property, but you could always key on the beforeitemclick or beforeselect event (or both, depending on what you need to do). Add a handler for this event, check if the clicked node is a leaf, and if it's not, simply return false. That will halt the default behavior and effectively disable the non-leaf nodes.
http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.tree.Panel-event-beforeselect

ExtJs 4.1.1 Tree Panel node selection logic

I am using tree panel is ExtJS.
Consider the above image as the tree panel. If user selects node 1.1.1.2, I should check if all its sibling are also checked/selected, if yes, system should select 1.1.1 node and deselect 1.1.1.1, 1.1.1.2, 1.1.1.3 nodes.
Similarly, At this point I should check the siblings of 1.1.1 node (1.1.2 & 1.1.3) & if they previously selected/checked, then I should deselect 1.1.1, 1.1.2, 1.1.3 and I should select 1.1 node.
This kind of check continues until I reach root node or one the siblings of selected node is not checked/selected.
What is the best way to achieve this. When I say best way, I am looking for some in-build property or method which will help me achieve this.
Thank you
I would start with the bubble method:
http://docs.sencha.com/extjs/4.1.1/#!/api/Ext.data.NodeInterface-method-bubble

In ExtJS 4, How do you delete a tree node when the associated grid information to the node is deleted at random

My code so far populates via drag and drop tree nodes and leaves from a grid panel. I want to know how to remove a tree node when the grid information associated with it is removed.
You should have something like id property in your model both in grid and tree. So when you remove record in the grid you then search for the node with this id in tree and remove it as well. Another way is just save the reference to the node when you drop it.
The flow is:
user drags and drops record from grid to the tree
when the record is dropped and new node is created you save reference in the grid's record
onNodeDrop: function(){
grid.getSelected().treeNode = tree.lastCreatedNode;
}
then when you delete record in grid you could delete node as well.
Note - this is just a psuedocode, is won't work. Just to give you an idea.

Resources