1. #1
    Sencha User
    Join Date
    May 2011
    Posts
    1
    Vote Rating
    0
    Toams is on a distinguished road

      0  

    Default Saving order after Drag and drop in a TreePanel<ModelData>

    Saving order after Drag and drop in a TreePanel<ModelData>


    Hi,

    I try to save the order of the elements of a treePanel<ModelData> in order to reproduce this ordre later. (I already developpe the server side).
    When I want to set the new order for each element

    When I try to update the position of each elem the list I have do not contains
    the operation I could make. It is exactly the same list in the same order than when I create the store..

    Code:
    model = new ModelPopup(listeModel, true);
    store = new TreeStore<ModelData>();
    store.add(model.getChildren(), true);
    
    final TreePanel<ModelData> tree = new TreePanel<ModelData>(store);
    tree.setDisplayProperty("name");
    store.sort("order", SortDir.ASC);
    
     new TreePanelDragSource(tree);
            final TreePanelDropTarget target = new TreePanelDropTarget(tree){
            @Override
                public void onDragDrop(DNDEvent e) {
                    super.onDragDrop(e);
                    int i = 0;
                    // I try to update the position of each elem but the list have the order before the first sort 
                    for (ModelData Element : store.getAllItems()){
                        final ModelArbrePopup element = (ModelArbrePopup) Element;
                        element.setOrder(i);
                        GWT.log(element.getName());
                        i++;
                    }
                }
            };
            target.setAllowSelfAsSource(true);  
            target.setFeedback(Feedback.BOTH);

    I hope than someone could help me

    thanks

  2. #2
    Sencha User
    Join Date
    Sep 2011
    Location
    Leipzig, Germany
    Posts
    73
    Vote Rating
    0
    A.Rothe is on a distinguished road

      0  

    Default


    I think, in the API docs you can find, that store.getAllItems() returns a list of all models without any order...

    ~Andre

  3. #3
    Sencha User
    Join Date
    Sep 2011
    Location
    Leipzig, Germany
    Posts
    73
    Vote Rating
    0
    A.Rothe is on a distinguished road

      0  

    Default


    Try TreeStore.getRootItems() and TreeStore.getChildren(model, true) to build your own list. The method getModels() returns the same as getAllItems().

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar