Announcement

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

    How to force complete update in ListGrid

    Hello, I have a datasource which is edited by a ListGrid. Once I edit some data, I get a request to the server, but this request only has the modified fields. In the server, I have to call an update service which expects the update to contain all the data, the old and the new. It's really a replace operation.
    Is there a way to force the ListGrid or the DataSource to send always all the data to the server? If not, Is it possible to get the old field values in the datasource or the request so I can manually merge them with the new values?

    #2
    Originally posted by getaceres
    Hello, I have a datasource which is edited by a ListGrid. Once I edit some data, I get a request to the server, but this request only has the modified fields. In the server, I have to call an update service which expects the update to contain all the data, the old and the new. It's really a replace operation.
    Is there a way to force the ListGrid or the DataSource to send always all the data to the server? If not, Is it possible to get the old field values in the datasource or the request so I can manually merge them with the new values?
    From what I have observed with the RestDataSource using XML data format, there is a node called "oldValues" included in request which should meet your needs.

    If you use Fiddler (http://www.fiddler2.com/fiddler2/) or some other http diagnostic tool you should be able to see it in the request coming through.

    Comment


      #3
      Thanks, now I can merge the values but I've found a problem. Is there a way to distinguish between a value that is not set and a value that has been deleted? I mean. Suppose I have the following values:

      fieldA: valueA
      fieldB: valueB

      and that I delete valueB. I will receive a request with both fieldA and fieldB null and the reason is that valueA hasn't been changed, while valueB has been deleted. How can I know that in my datasource?

      Comment


        #4
        If a field has been actually changed to blank, you'll receive a blank element.

        Comment


          #5
          I'm debugging and it sends null when I delete a cell content in my ListGrid. In transformRequest, I do
          Code:
          ListGridRecord inRecord = new ListGridRecord(request.getData());
          and then I iterate over the attributes in inRecord so I see that it only has one attribute (the one that has been modified) and its value is null. Anyway, in my example, that would mean that I only will receive the modified attributes. In that case I will only get fieldB=null and not fieldA=null so I can overwrite safely the old values with all the new ones.

          Comment

          Working...
          X