Announcement

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

    Advice on sending a queue of "add" requests

    I have a ListGrid with records in it from a client only data source A. I need select some of the ListGrid records and submit an "add" request to datasource B for each one. When each "add" request completes I need to update the ListGridRecord associated with that add request, flagging it with an error if the request was not successful, or updating a field value it it was.

    My plan is to use RPCManager.startQueue() and sendQueue() to process all the adds in one roundtrip to the server. On each DSRequest I create I'll use setAttribute() to put the ListGrid record index on the request so it will be returned on the callback.

    I suppose my only question is, how do I know when I've processed the last response in the queue? There is no callback on the sendQueue() method. Each DSRequest will result in a callback, but how do I know when I've processed the last one?

    #2
    This kind of sounds like a duplication of the functionality of ListGrid.autoSaveEdits:false, which already handles propagation of updates, display of errors etc - is your use case fundamentally different somehow?

    In the latest nightlies, sendQueue() does now have an optional callback. However, if you need to use the release version, you can always pass a callback on the last operation in the queue, since execution and callbacks are in-order.

    Comment


      #3
      It is identical to ListGrid.autoSaveEdits(false) with a saveAllEdits() triggered by another user action. The problem is, the data source I need to save to is not the same data source that is used to load the grid. I need to take selected records from the grid and add them to a different data source, one that isn't visible directly in the UI.

      Comment

      Working...
      X