How to get multiple edited cells value from datatable after clicking of the save button

Hi webix Team

Here iam facing issue as after editing the cells, iam getting only single cell value, how to get the multiple cells value after editing multiple cell, when clicking of save button.

plz follow below snippet
https://webix.com/snippet/b7128f95

thanks in advance

Hi,

On the client side, all changes are registered one by one.

So the first option is just to gather updates manually in some variable.

A second solution suits most of all for sending data to the server-side.

By default, DataProcessor (a module which handles data saving) processes each update separately. If you need to gather the data and send all updates in one request, instead of manual gathering you can use a custom proxy object which will do the trick:

webix.proxy.all = {
  $proxy:true,
  //send all changed records to server
  saveAll:function(view, updates, dp, callback){
    webix.ajax().post(this.source, {data:updates}, callback);
  },
  //process common response on client
  result:function(state, view, dp, text, data, loader){
    data = data.json();

    for(var i = 0; i<data.length; i++){
        dp.processResult(data[i], data[i], {text:text, data:data, loader:loader})
    }
  }
};

https://webix.com/snippet/481b9b6f (as the real backend of this sample will not process the data, server response is emulated)

In such case, the data will be sent as one bunch.

1 Like

Hi Listopad

Thank’s for spending a valuable time withus,

Here our requirement is once edit the multiple cells in datatable, and after clicking the save button i want to get the webix message like (old value has changed to new value(means updated value)).

Thank’s in advance
Deepak

Unfortunately, the datatable itself doesn’t track such history. DataProcessor tracks changes, but in a bit different way, it tracks only the new values

In your case, the best approach will be to use onAfterEditStop event and store its values in some temporary structure - please check the next snippet

https://webix.com/snippet/4038d4b7

Hi maksim

thank’s for reply, every thing working fine, but every item click we are getting message, but our requirement we want to get message for onchange of value.

Thank’s in advance
Deepak E

Just add an extra check, which will prevent saving info about unchanged data

https://webix.com/snippet/b006bf51

          onAfterEditStop:function(state, editor){
            if (state.old == state.value) return true;