Announcement

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

    Correct approach for drag tracker handling

    Hello all,

    We have a somewhat complex application built with smartgwt and we're using drag'n'drop features between trees and listgrids. I'm trying to implement a proper logic for showing a drag tracker indicator on components which are not accepting drops. It kind of works between listgrids when we set setCanAcceptDroppedRecords = false on grids we don't want drops on and by overriding willAcceptDrop method to return false.

    What we would like to achieve is that the UI would show a not accepting drop indicator everywhere where drop is not possible and accepting indicator only on the few grids we intend the records to be dropped on. Any ideas how we should approach this ?

    Thanks!
    Marko

    #2
    Take a look at the ability to set a dragType and dropTypes for components (these are Canvas-level APIs). If the dragType for the component that initiated the drag is not present in the dropTypes for a candidate drop target, you should see the no-drop icon as you want.

    Comment


      #3
      Originally posted by Isomorphic View Post
      Take a look at the ability to set a dragType and dropTypes for components (these are Canvas-level APIs). If the dragType for the component that initiated the drag is not present in the dropTypes for a candidate drop target, you should see the no-drop icon as you want.
      Ok thanks. Is there an easy way to change the default from Canvas.ANYTHING to basicly NOTHING ? Or do I have to set something to the drop type for _every_ component I have in my application ? Wouldn't "nothing" be a more sensible default in a real work scenario as the drop must be usually handled spesifically anyway ?

      I tried

      Code:
              Canvas canvas = new Canvas();
              canvas.setDropTypes("nothing");
              Canvas.setDefaultProperties(canvas);
      But it has no effect.

      Comment


        #4
        Set the *dragType* on the source component and nothing will be an eligible drop target until is has dropTypes set on it.

        Don't go any further will your attempt to change system defaults, you'll just break all the built-in drags (header reorder, etc).

        Comment


          #5
          I'm having hard time getting this to work. For some reason setting drag and/or droptype to canvas has no effect in my code. Is there a limitation that if you're using _record_dropping from and between list grids the drag types do not work ?

          Comment


            #6
            It should be having an effect even for record drags, yes. If you can show us the complete code, we may be able to spot the problem. You can also just go modify any of the drag and drop samples to see the effect of the properties.

            Comment

            Working...
            X