Results 1 to 3 of 3

Thread: Remove row from a treegrid

  1. #1
    Sencha User
    Join Date
    Nov 2014
    Posts
    53
    Answers
    4

    Default Answered: Remove row from a treegrid

    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
    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..

  2. Quote Originally Posted by JackJohnsonX View Post
    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
    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:

    Code:
    var selection = treepanel.getSelectionModel().getSelection();
    selection[0].remove();
    store.sync();
    Thanks!
    Joel

  3. #2
    Sencha User joel.watson's Avatar
    Join Date
    Nov 2014
    Posts
    3,120
    Answers
    446

    Default

    Quote Originally Posted by JackJohnsonX View Post
    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
    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:

    Code:
    var selection = treepanel.getSelectionModel().getSelection();
    selection[0].remove();
    store.sync();
    Thanks!
    Joel

  4. #3
    Sencha User
    Join Date
    Mar 2017
    Location
    Pune
    Posts
    2

    Default

    onDeleteRow : function(grid, rowIndex, colIndex) {
    //debugger;
    gridStore.getRootNode().childNodes[rowIndex].remove();
    },

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •