Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    ListGrid intercept and stop drop from a drag and drop

    SmartGWT Nightly from 10292010
    GWT 2.0.4

    I can't seem to find how to intercept a drop from a drag and drop.

    I have 3 ListGrid's
    1...primary has values from my DataSource (can drag to 2 or 3 but none can drop here)
    2...qualifiers has values that can be dropped from 1 (can only receive drop)
    3...excludes has values that can be dropped from 1 (can only receive drop)

    What I want to do is ...if the record is already in 3 then it can't be dropped to 2.

    Is there a way to intercept the drop and stop it from being added to 2 if it exists in 3 already?

    Thank you for your help.

    UPDATE: I found I can use addRecordDropHandler, from another post.
    Last edited by gilcollins; 1 Nov 2010, 13:08.

    #2
    Yes 'recordDropHandler()' should work for you. Let us know if you run into further issues

    Comment


      #3
      Right.

      The way to do this is to cancel the event like this :

      Code:
      this.addRecordDropHandler(new RecordDropHandler() {
          @Override
          public void onRecordDrop(RecordDropEvent event) {
              boolean dontDropThisOne = true;
              if (dontDropThisOne) {
                  event.cancel();
              }
          }
      });

      Comment

      Working...
      X