Announcement

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

    #16
    When you pass a record created by "new Record()" to updateData(), that's still an update, not an add.

    Comment


      #17
      I understand now. Makes sense. That solved half of the problem. Using the new code below, only the updated field is being reported. Gr8.

      Code:
      ...
        for (ListGridRecord row : listGrid.getRecords()) {
      	if (Integer.parseInt( row.getAttribute(DISPLAY_ORDER)) != i) {
      		Record newRow = new Record();
      		newRow.setAttribute(ID, row.getAttribute(ID));
      		newRow.setAttribute(DISPLAY_ORDER, i);
      		listGrid.updateData(newRow);
      	}
      	i++;
       }
      ...
      Unfortunately, the other half of the problem still remains: the reported oldValue is the same as the newValue. Shouldn't the oldValue be the original value fetched from the datasource?

      Comment


        #18
        That would be magic, since you're not providing the old record to the updateData() API. But you can do so, via the requestProperties argument and the dsRequest.setOldValues() API.

        Comment


          #19
          Any save operation automatically initiated by a component, including for example ListGrid saves due to canEdit:true, or form saves due to saveData(), will include the old values.

          Here, you are bypassing all components and going directly to DataSource-level APIs, you need to do what the component does automatically in these other cases, and provide the existing Record as dsRequest.oldValues.

          Note this is also true of ListGrid.updateData() because it's just a pass-through to the DataSource API - it has no context about what record is being updated or whether it's even present in the browser.

          Comment


            #20
            When you put it that way, it makes perfect sense. Thanks for the quick responses and helpful insight. That's cleared up my confusion.

            cheers,
            Brenton

            Comment

            Working...
            X