PDA

View Full Version : Remove row from a treegrid



JackJohnsonX
24 Feb 2015, 4:58 PM
I have a treegrid exactly like the Kitchen Sink Tree Grid example:
http://docs-origin.sencha.com/extjs/4.2.2/#!/example/build/KitchenSink/ext-theme-neptune/#tree-grid

t (http://docs-origin.sencha.com/extjs/4.2.2/#!/example/build/KitchenSink/ext-theme-neptune/#tree-grid])his grid actually extends Ext.tree.Panel and uses Ext.data.TreeStore

So how can I remove a row? With a regular grid using Ext.data.Store I can just get the selected row using SelectionModel().getSelection() and pass the returned record into the store.remove( ) but I dont see any such method for a treestore.


thanks..

joel.watson
6 Mar 2015, 7:32 AM
I have a treegrid exactly like the Kitchen Sink Tree Grid example:
http://docs-origin.sencha.com/extjs/4.2.2/#!/example/build/KitchenSink/ext-theme-neptune/#tree-grid

t (http://docs-origin.sencha.com/extjs/4.2.2/#!/example/build/KitchenSink/ext-theme-neptune/#tree-grid])his grid actually extends Ext.tree.Panel and uses Ext.data.TreeStore

So how can I remove a row? With a regular grid using Ext.data.Store I can just get the selected row using SelectionModel().getSelection() and pass the returned record into the store.remove( ) but I dont see any such method for a treestore.

Hi--

You can just call remove() on the node itself, and then sync the store:



var selection = treepanel.getSelectionModel().getSelection();
selection[0].remove();
store.sync();


Thanks!
Joel

amolkhot
20 Mar 2017, 9:56 PM
onDeleteRow : function(grid, rowIndex, colIndex) {
//debugger;
gridStore.getRootNode().childNodes[rowIndex].remove();
},