This is a migrated thread and some comments may be shown as answers.

How to disable dirty for certain properties - Observable / DataSource

3 Answers 257 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Long
Top achievements
Rank 1
Long asked on 16 Jul 2014, 03:43 PM
Is there anyway to disable the dirty flag from being set for a few properties so that the DataSource does not think there are changes?

For example I may have a model defined as: 

var model = new kendo.data.Model({
name: "John Doe",
visible: true
});

However when I change the visible (to hide or display something using CSS MVVM binding), I don't want the DataSource to think that my model is "dirty" and send that back to the server, however I do want MVVM binding to still work so that I can hide or show.

3 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 18 Jul 2014, 11:32 AM
Hello Long,

This isn't possible. Changing field value of the model marks it as dirty. This is how changes are being tracked in the model state. You can however set back the dirty flag to false. 

Regards,
Nikolay Rusev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Long
Top achievements
Rank 1
answered on 20 Jul 2014, 05:39 AM
Unfortunately when the DataSource is set to AutoSync: true, changes are already sent to the server before the DataSource.Change event gets fired (the Change event was where I was hopping to intercept the model and set dirty = false) if it wasn't a field that needed to be tracked e.g. IsVisible property for a table row.
0
Nikolay Rusev
Telerik team
answered on 22 Jul 2014, 11:05 AM
Hello Long,

Indeed in case of auto sync this will happen. Changing field from the model will trigger change  which will propagate to the DataSource and if autoSync is configured it will initiate a request.

Regards,
Nikolay Rusev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Data Source
Asked by
Long
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Long
Top achievements
Rank 1
Share this question
or