Announcement

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

    How to avoid dragging operation being interrupted by a DS update?

    Scenario:
    A listgrid is updated frequently by automated processes, i.e. some values are changed for existing records using the following code:
    Code:
     
    DSRequest requestProperties = new DSRequest();
    requestProperties.setAttribute("clientOnly", true);
    ds.updateData(someNewRecordWithExistingPrimaryKey, someCallback, requestProperties);
    So a new record but with the same primary key is added locally on the client, which replaces the existing one. All listgrids using this DS are automatically updated accordingly.

    Now there is a problem if the update happens while the user is in the process of draggin records from a listgrid that uses this DS.
    In case of an update, selected records that are updated are deselected and all dragging operations containing these records silently fail, i.e. no onDropHandler is invoked for the target.
    Can this be fixed?

    Thanks
    fatzopilot

    SGWT 2.4, Firefox 4.01., Chrome 11

    #2
    Try producing a runnable test case showing this effect.

    Comment


      #3
      Well, I actually found the issue to be the deselction of the dragged records in the source grid.
      The drop target is a custom component with a dropHandler that determines the dropped records like this:
      Code:
      ...
      addDropHandler(new DropHandler() {
        @Override
        public void onDrop(DropEvent event) {
      ...
          ListGridRecord[] selectedRecords = ((ListGrid)EventHandler.getDragTarget()).getSelection();
      ...
        }
      });
      And since some of the records are deselected by the update in the source grid, they are not included in the target selection.
      This does not happen with SGWT databound components as a target, so they seem to use other mechanisms for d'n'd (not a drop handler).
      So the questions ist: Is there a better approach to detect the records that should be dragged (maybe the one SGWT uses for dragging records from one listgrid to another)?

      Thanks
      fatzopilot

      Comment

      Working...
      X