1. #1
    Ext User
    Join Date
    Dec 2008
    Posts
    7
    Vote Rating
    0
    suvarnal is on a distinguished road

      0  

    Default Tree to Tree drag and drop and ListView, Grid drag and drop to Tre not working proper

    Tree to Tree drag and drop and ListView, Grid drag and drop to Tre not working proper


    Hi,
    I am using Ext GWT 1.2.
    I have a left side panel having a Tree and a right side panel having ListView and Grid.
    When any tree item is clicked its children are shown in the right panel ListView and Grid.
    I have added drag and drop functionality within the tree (like reordering tree example http://extjs.com/explorer-dev/#reorderingtree) and also drag and drop from the right panel Grid/ListView to the Tree.
    When I drag any item from right side ListView or Grid or from the Tree itseft and drop it to any other item in Tree, sometimes the item is lost. Sometimes its not shown under the Tree item to which it was dropped, but it is there in its children list. Sometimes the dropped item is shown below the tree item to which it was dropped, it should be shown inside it.
    I tried combinations of Feedback and Operation types, but none worked properly.
    The Tree has no TreeStore, the Grid and ListView have same ListStore.
    Following is the code:
    HTML Code:
     leftPane.getTree().addListener(Events.OnClick, new Listener<TreeEvent>() {
                public void handleEvent( TreeEvent be)
                {
        // show children in Grin and ListView
                    showContents((TreeItem)leftPane.getTree().getSelectedItem());
                }
            });
            // tree to tree
            TreeDragSource source = new TreeDragSource(leftPane.getTree());
            source.addDNDListener(new DNDListener() {
              @Override  
              public void dragStart(DNDEvent e) {
                TreeItem item = leftPane.getTree().findItem(e.getTarget());
                if (item != null && item == leftPane.getTree().getRootItem().getItem(0)) {
                  e.doit = false;  
                  e.status.setStatus(false);  
                  return;  
                }  
                super.dragStart(e);
              }
            });
            // thumb-nails view to tree 
            new ListViewDragSource(rightPane.getThumbNailsView());
            new GridDragSource(rightPane.getGrid());
     
            TreeDropTarget target = new TreeDropTarget(leftPane.getTree()) {
              @Override
              protected void handleAppendDrop(DNDEvent event, TreeItem item){
                  DragSource source = event.source;
                  if(source instanceof ListViewDragSource || source instanceof GridDragSource)
                  {
                      List<BeanModel> sel = (List) event.data;
                      for (BeanModel bean : sel)
                      {
                          Folder folder = bean.getBean();
                          TreeItem newItem = new TreeItem();
                          newItem = new TreeItem(folder.getName());
                          newItem.setId(folder.getId());
                          String isFile = folder.getIsFile();
                          if("false".equals(isFile))
                              newItem.setLeaf(false);
                          else
                              newItem.setLeaf(true);
                          newItem.setData("name", folder.getName());
                          newItem.setData("status", folder.getStatus());
                          newItem.setData("isFile", folder.getIsFile());
     
                          TreeItem removeItem = leftPane.getTree().getItemById(folder.getId());
                          if(removeItem != null)
                          {
                              removeItem.getParentItem().remove(removeItem);
                          }
                          item.add(newItem);
                      }
                  }
                  else
                  {
                      super.handleAppendDrop(event, item);
                  }
              }
            };
            target.setAllowSelfAsSource(true);
            target.setFeedback(Feedback.APPEND);
    What am I missing?

  2. #2
    Ext User Pmithrandir's Avatar
    Join Date
    Sep 2008
    Location
    Rennes - France
    Posts
    40
    Vote Rating
    0
    Pmithrandir is on a distinguished road

      0  

    Default


    if your drag object drop in the wrong place, can't you define setGroup("test"); on start and drop zone ?

  3. #3
    Ext User
    Join Date
    Dec 2008
    Posts
    7
    Vote Rating
    0
    suvarnal is on a distinguished road

      0  

    Default


    I added setGroup("test"); to all DragSource objects and to the DragTarget object.
    Its still not working.
    Object is not getting dropped in wrong place...that is not the problem. The drag and drop gets completed. The item gets added in the tree item to which it was dropped but it is not shown under it in the tree. With my other functionality if I click on that tree item to which onject was dropped, all its children are shown in the right panel with the newly added(dropped) item.
    Any suggestions to sort this problem out?

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