[CLOSED] Keep TreePanel´s selection after local sort

  1. #1
    Hi folks, when a node is selected and then, a sort is performed, the selection is cleared.

    Any idea to overcome this issue?

    <ext:TreePanel ID="TreePanel2" SelType="Checkbox" runat="server" Title="Tree" Height="700"
        Width="400" Margins="10" RootVisible="false" Border="false">
        <Store>
            <ext:TreeStore ID="TreeStore1" runat="server">
                <Proxy>
                    <ext:AjaxProxy Url="/Example/LoadFakeChildren">
                        <ActionMethods Read="POST" />
                        <Reader>
                            <ext:JsonReader Root="data" />
                        </Reader>
                    </ext:AjaxProxy>
                </Proxy>
            </ext:TreeStore>
        </Store>
        <Root>
            <ext:Node NodeID="0" Text="Root" />
        </Root>
        <Fields>
            <ext:ModelField Name="Task" />
        </Fields>
        <ColumnModel>
            <Columns>
                <ext:TreeColumn ID="TreeColumn1" runat="server" Text="Task" Flex="2" Sortable="true"
                    DataIndex="Task" />
            </Columns>
        </ColumnModel>
        <SelectionModel>
            <ext:CheckboxSelectionModel ID="CheckboxSelectionModel1" runat="server"
                Mode="Multi" />
        </SelectionModel>
    </ext:TreePanel>
    public StoreResult LoadFakeChildren()
    {
        NodeCollection nodes = new NodeCollection(false);
    
        for (int index = 1; index < 6; index++)
        {
            Node no = new Node();
            no.NodeID = index.ToString() + DateTime.Now.Second;
            no.CustomAttributes.Add(new ConfigItem { Name = "Task", Value = no.NodeID, Mode = ParameterMode.Value });
            nodes.Add(no);
        }
    
        return new StoreResult { Data = nodes.ToJson() };
    }
    Last edited by Daniil; Jun 25, 2012 at 12:19 PM. Reason: [CLOSED]
  2. #2
    Hi,

    I am not 100% sure the CheckboxSelectionModel and RowSelectionModel can be used with TreePanel. But why not? At least, I can't see any restriction in the ExtJS docs.

    And it works if set up
    PruneRemoved="false"
    for the CheckboxSelectionModel.

    See also
    http://docs.sencha.com/ext-js/4-1/#!...y-pruneRemoved

    One doubt - it's marked as "private". I am not 100% sure there won't be any backside effects.

    If you will face any troubles further, please report us.
  3. #3
    it works like a charm. please mark it as resolved.

Similar Threads

  1. Replies: 4
    Last Post: Jul 25, 2011, 4:57 PM
  2. Replies: 4
    Last Post: Nov 11, 2010, 11:46 AM
  3. Problem with TreePanel Selection[1.0]
    By suchit_patel in forum 1.x Help
    Replies: 0
    Last Post: Jul 21, 2010, 8:38 AM
  4. [CLOSED] Inserted records dissapear after local sort operation
    By pschojer in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Apr 23, 2010, 5:00 AM
  5. TreePanel Selection
    By erey in forum 1.x Help
    Replies: 0
    Last Post: Jul 02, 2009, 4:12 PM

Posting Permissions