Search code examples
kendo-uikendo-datasource

Does kendo.data.dataSource store the old value somewhere?


Lets say that you have a kendo.data.DataSource. and you modify a row. and the row has become dirty. and now you want to compare if a specific column was changed before you save.

Does kendo.data.DataSource store the old value locally somewhere?

I suspect it does since it seems that you can call .cancelChanges() and .cancelRow() however i cant seem to find it.

I also suspect that you are not supposed to use it.


Solution

  • You are correct that you are not suppose to use this, but it is located in the Data Source.

    The currently displayed data/dirty data to be submitted is stored in dataSource._data The last saved value/non-dirty data is stored in dataSource._pristineData

    The dirty flag is also stored in _data.


    In general you don't want to be messing with any variable that begins with the _. You can alternatively save out the current data with the get/set function kendo provides. The dataSource.data() function. Update it with the same function dataSource.data(myNewData)