Announcement

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

    Drag/Drop question with TileGrids

    Hello,

    Continuing my story ended at: http://forums.smartclient.com/showthread.php?p=62738, I stumble upon a next challenge: many to many tables.

    Once I drag + drop an entry the saving happens automatically. But this is a problem, because it doesn't know the Flavour_id yet.

    I have this Flavour_id locally in some variable, but how can I insert that just when the record is being saved (ie. 'onDrop')?

    The cleverness of SmartGWT saves it automatically, but somehow misses the case of many to many relations, where there is an intermediate table connecting Pattern and Flavours (via the datasource Flavour_hasPatterns_Pattern in my case)

    So I want to intervene here, and just before the save add an attribute via Record.setAttribute("Flavour_id", myFlavId); (or a similar solution)

    Any thoughts?

    Thanks.

    #2
    You can use setDropValues() to provide values that should be added to the dropped record data to make a complete record to be saved. If this won't work, you can instead cancel() the drop event and do the persistence manually yourself.

    Comment


      #3
      Thanks.

      I have now fixed it with a 'hack', where I add a field to the Pattern.ds.xml called Flavour_id, and populate it on fetching, in the DSCallback. This works, but I feel it is not so elegant.

      Will try your suggestions too.

      Comment


        #4
        setDropValues works like a charm, thanks.

        Comment

        Working...
        X