I have a view where i have autocomplete with datasource (ds) where user can search (for person) and when it select in select function for autocomplete i have
then in my viewModel i have a method where i fill observable property
when user click edit in my ViewModel a call this method
then user change the fields (example name) in a view and when it hits Save
save: function () {
alert(ds.hasChanges());// this returns false even if i look to the this.selectedItem and i see that binding is pushet to the observable property
ds.sync();
}
this issue is when in function changeMode i use ds.read(), if i remove it it works
select: function (sel) {
var dataItem = this.dataItem(sel.item.index());
var md = ds.get(dataItem.id);
model.selectContact(md);//set the observable
},
then in my viewModel i have a method where i fill observable property
selectContact: function (cust) {
this.set('selectedItem', cust);//this is a observable property
}
when user click edit in my ViewModel a call this method
changeMode:function() {//ds is the kendoDataSource
ds.read();//hear i need to have the latest data so i do a read from db
var dr2 = ds.get(this.selectedItem.id);//get last id from datasource that it was selected in autocomplete
this.set('selectedItem', dr2);//now hear is the latest data in observable property
}
then user change the fields (example name) in a view and when it hits Save
save: function () {
alert(ds.hasChanges());// this returns false even if i look to the this.selectedItem and i see that binding is pushet to the observable property
ds.sync();
}
this issue is when in function changeMode i use ds.read(), if i remove it it works