1. #1
    Sencha User
    Join Date
    Dec 2007
    Posts
    57
    Vote Rating
    1
    MickeyMiner is on a distinguished road

      0  

    Default Unanswered: DnD: Detect model in TreeGrid where mouse currently moves over

    Unanswered: DnD: Detect model in TreeGrid where mouse currently moves over


    Hi,

    In a TreeGrid I would like to enable or disable nodes of the tree depending on their properties.
    How do I detect the model in the tree where my mouse currently moves over?

    Thanx,

    mm

    Code:
    TreeGridDropTarget<MyModel> target = new TreeGridDropTarget<MyModel>(grid);
            target.setAllowSelfAsSource(true);
            target.setAllowDropOnLeaf(false);
            target.setFeedback(DND.Feedback.BOTH);
            target.addDragMoveHandler(new DndDragMoveHandler() {
                @Override
                public void onDragMove(DndDragMoveEvent event) {
                    MyModel m = .......  // TO DO please add code here
                    Info.display("onDragMove()", m.toString());
                    if (m.acceptsDrops()) {
                        event.getStatusProxy().setStatus(true);
                    } else {
                        event.getStatusProxy().setStatus(false);
                    }
                }
            });

  2. #2
    Sencha User
    Join Date
    Dec 2007
    Posts
    57
    Vote Rating
    1
    MickeyMiner is on a distinguished road

      0  

    Default


    Hi,

    This solution works... but only partially...
    If I drag an object between two nodes, the object can dropped over there... But I would like to prohibit dropping objects elsewhere but on a specific folder (setAllowDropOnLeaf() is not good enough)...

    m.

    Code:
    TreeGridDropTarget<MyModel> target = new TreeGridDropTarget<MyModel>(grid);
    target.setAllowSelfAsSource(true);         
    target.setAllowDropOnLeaf(false);
    target.setFeedback(DND.Feedback.BOTH);
    target.addDragMoveHandler(new DndDragMoveHandler() {
        @Override
        public void onDragMove(DndDragMoveEvent event) {
           DragMoveEvent e = event.getDragMoveEvent();
           NativeEvent n = e.getNativeEvent();
           EventTarget et = n.getEventTarget();
           Element itemMovedOverElement = (Element) et.cast();
           MyModel m = grid.findNode(itemMovedOverElement).getModel();
           Info.display("onDragMove()", m.toString());                 
           if (m.acceptsDrops()) {
              event.getStatusProxy().setStatus(true);
           } else {
              event.getStatusProxy().setStatus(false);                 
           }
       }  
    });

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