Ticket T191423
Visible to All Users

dxDataGrid passes only modified values to the CustomStore.update method

created 10 years ago

Hi,

I'm building an ASP.NET MVC 4 application, and using the dxDataGrid control to display and manipulate my data. The CRUD operations are implemented on the server side.
I have a problem with the Update operation, bellow is the js code I use to get the data from the row being edited, to post it to the server.

JavaScript
update: function (key, values) {             var params = $.extend({}, values);             params[dbImpl.key] = key;             var url = '/MyController/Update/';             return dbImpl._sendRequest('PUT', url, params);

Suppose the object is of type Employee and have 3 properies (FirstName, LastName, Tel), and the user edit only the 'Tel' property. On the server side, the object posted 'employee' has only the value of 'Tel' property, the two other properties are NULL ! (even thought the employee has a FirstName and a LastName).

Is this the default behaviour of the dxDataGrid ? Not getting the values of properties not edited. Or I'm missing something ?!

Thanks in advance

Answers approved by DevExpress Support

created 10 years ago (modified 4 years ago)

Hi,

Yes, this is default behavior. dxDataGrid passes only modified values to the update method. We did this for preventing sending redundant data to the server side. Let's assume that you have 20 columns in your grid and several columns have binary data. You modified values in a couple of columns and click the update. In your scenario, dxDataGrid should pass values for all columns to the update method even if only two of them are modified. In this case, you need to pass these values to the server side and serialize your data during each update. Moreover, you will need to update all data fields in the modified record even if most of values are not modified. This behavior causes redundant actions with unmodified data and we are confident that it is not correct. If this behavior does not meet your requirements, you can overcome it by executing the following code in dxDataGrid.onRowUpdating:

JavaScript
onRowUpdating: function(options) { options.newData = $.extend({}, options.oldData, options.newData); // non-jQuery options.newData = {...options.oldData, ...options.newData}; }
    Show previous comments (1)
    DevExpress Support Team 10 years ago

      Hello,

      To process your recent post more efficiently, I created a separate ticket on your behalf: T216562: dxDataGrid - How to pass all values to the CustomStore.update method. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

      F F
      Felipe Vivas Publicis 9 years ago

        Hi Nikolai, i understand that send unmodified data to the server is not a good practice, can you show us some implementation of the partial update using web api and c#?
        thanks for your comments…

        DevExpress Support Team 9 years ago

          Hi Claudio,

          We kindly ask you not to post your questions in tickets that were created by other users. I've created a new ticket on your behalf. Post your comments in the dxDataGrid - How to implement CRUD operations on the server side ticket.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.