Announcement

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

    Equivalent setOldValue() method exist?

    Version: SNAPSHOT_v9.0d_2013-02-24/PowerEdition Deployment (built 2013-02-24)

    I am using
    Code:
    grid.setEditValue( row, field,  "a string");
    to set side-band information for the server when using
    Code:
    grid.saveAllEdits();
    It works fine. But I would much rather put this side-band in the oldValues map used during the edit save. How can I do this?

    In short is there a way of effectively doing:
    Code:
    grid.setOldValue( row, field,  "a string");
    which the server can retrieve in a call to:
    Code:
    request.getOldValues();
    ?

    #2
    No, there's no way to sneak extra values into oldValues (and that also seems like a bad hack - your current approach is better).

    Comment


      #3
      SNAPSHOT_v9.0d_2013-02-24/PowerEdition Deployment (built 2013-02-24)

      All is well when using
      Code:
      grid.setEditValue( row, field,  "a string");
      and doing updates on a grid using grid.saveAllEdits();

      However when I want to do a delete of a record/row on the grid using
      Code:
      grid.setEditValue( row, field,  "a string");
      grid.setRemoveOperation("removeRecord");
      grid.saveAllEdits();
      The server only sees the Old Values in both the
      Code:
      request.getValues();
      request.getOldValues();
      and nowhere the edit side-band information in 'field'.

      How may I pass this side-band information in the remove operation case?

      Comment


        #4
        We're not sure what you have in mind when you say "side-band" information. By design, we do not provide a way to "smuggle" extra information to the server, because if this extra information means your operation behaves differently, that could interfere with the framework's ability to manage caching and automatic cache updates.

        dsRequest.operationId, which you are setting via listGrid.removeOperation, is the correct way to declare that an operation behaves differently from other "remove" operations on the same DataSource.

        If you're trying to pass something on a per-record basis, if it's some actual data field, it could be present in the Record when data is first loaded, and it will appear in oldValues along with any other data attribute.

        If that's not sufficient, please explain how this "side-band" information affects behavior, and we can suggest an approach for handling it.

        Comment


          #5
          The grid being edited is created by indexing through a higher level SQL table. The records of the editable grid contains a Foreign Key that points back to rows in that top level table.

          I have been using saveEditValue() to pass some of the key fields values from the top level table to the server on updates. This saves the server from having to do a fetch of rows from the top level table as this data is known to the client.

          With having no way of passing that data in the remove operation I am forcing the server to do a fetch in addition to the delete for the editable grid.

          I suppose I could extend the datasource for the editable grid to also store these top level values in hidden fields, but it could be a lot of duplicated data.

          Comment


            #6
            Don't really follow.

            If you don't already have the information from the "top level table" client-side when editing begins, then you would have to do a fetch to get it, so you're not saving any fetches by adding it in right before saving.

            If you *do* already have the information from the "top level table" client-side, then why don't you just put this information in the records before you feed it to the grid? That means the data will be in oldValues, and it's not going to cause any duplication..

            Comment

            Working...
            X