[CLOSED] there is no remove method in treestore?

  1. #1

    [CLOSED] there is no remove method in treestore?

    a treepanel, in it a TreeSelectionModel and a treestore,
    how to remove the selected row using tree store?
                    <ext:Toolbar runat="server">
                            <ext:Button runat="server" Text="删除" Icon="Delete">
                                    <Click Handler="var selection = #{TreeSelectionModel1}.getSelection();
                                                    if (selection) {
                                                        #{TreePanel1}.store.remove(selection);// here error, no remove method
                                                    };" />
                            <ext:Button runat="server" Text="确定" Icon="Disk">
                                    <Click OnEvent="BatchUpdate">
                                            <ext:Parameter Name="data" Value="App.TreePanel1.store.getChangedData()" Mode="Raw" Encode="true" />
                                        <EventMask ShowMask="True"></EventMask>
                            <ext:Button ID="bt_fresh" runat="server" Text="刷新" Icon="PageRefresh">
                                    <Click Handler="window.location='column.aspx';"></Click>
                    <ext:Node NodeID="0" Text="根节点">
                            <ext:ConfigItem Name="id" Value="0"/>
                            <ext:ConfigItem Name="colname" Value="根栏目"/> 
                    <BeforeLoad Fn="nodeLoad" />
                    <ext:TreeStore runat="server" ID="s_column">
                            <ext:Model runat="server">
                                    <ext:ModelField Name="id"></ext:ModelField>
                                    <ext:ModelField Name="colname"></ext:ModelField>
                                    <ext:ModelField Name="pid"></ext:ModelField>
                        <ext:Column runat="server" DataIndex="id" Text="编号"></ext:Column>
                        <ext:TreeColumn runat="server" DataIndex="colname" Text="栏目" Flex="1">
                                <ext:TextField runat="server"></ext:TextField>
                        <ext:Column runat="server" DataIndex="pid" Text="父id">
                                <ext:NumberField runat="server"></ext:NumberField>
                    <ext:CellEditing runat="server"></ext:CellEditing>
                    <ext:TreeSelectionModel ID="TreeSelectionModel1" runat="server" Mode="Multi" />
    Click image for larger version. 

Name:	QQ截图20130921190333.jpg 
Views:	14 
Size:	44.2 KB 
ID:	6920
    Last edited by Daniil; Oct 04, 2013 at 6:43 AM. Reason: [CLOSED]
  2. #2
    Hi @hdsoso,

    Indeed, there is no remove method in TreeStore. IMO, it is lack in the ExtJS API. I see related discussion on the Sencha forums, but for some reason they didn't add the method.

    Please use the following script.
    var tree =  App.TreePanel1,
        selection = tree.getSelectionModel().getSelection(),
        i, len;
    for (i = 0, len = selection.length; i < len; i++) {

Similar Threads

  1. [CLOSED] TreeStore issue with 2.2
    By paulc in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Aug 19, 2013, 10:24 AM
  2. Replies: 10
    Last Post: May 31, 2013, 1:54 PM
  3. Replies: 3
    Last Post: Apr 10, 2013, 5:05 AM
  4. [CLOSED] TreePanel & TreeStore setRootNode() not working anymore?
    By cleve in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Jan 15, 2013, 4:16 PM
  5. Add Remove
    By cbu in forum 1.x Help
    Replies: 3
    Last Post: Jan 10, 2012, 9:23 PM

Posting Permissions