I could have two clients editing the same page and want the changes adjusted immediately without refreshing the data source.
The listview is setup fairly normally. It feeds of a data source and in turn sends updates through a MVC controller update.
When the MVC action processes the update it notifies connected users to the group of the change(s) to items. This notification is the same response that the JSON Result responds with effectively.
Updating all clients is close to working:
Scenario 1: Client 1 and 2 goto the same page. Client 1 edits a field and those changes are reflected on client 2's screen.
Scenario 2: Client 1 and 2 edit the same row. Any saved changes by either are updated to the others edit fields.
The problem im getting is when Client 2 begins editing a different row. When it goes to Client 1 it is more seen as the edit state of the data row. A little more challenging to understand what i mean.
So yes... im more hiting my way through the data source to have my changes there. The SignalR function will seek out the row(s) to update and run:
01.
for
(
var
i = 0; i < menuItems.length; i++)
02.
{
03.
var
item = menuItems[i];
04.
var
dataSourceItem =
this
.findById(item.Id);
05.
if
(!dataSourceItem) {
continue
; }
06.
07.
var
thumbArray =
new
kendo.data.ObservableArray(item.Thumbs)
08.
dataSourceItem.set(
"WebName"
, item.WebName);
09.
dataSourceItem.set(
"WebDescription"
, item.WebDescription);
10.
dataSourceItem.set(
"Thumbs"
, thumbArray);
11.
//however each item is now dirty ... and i don't want to send off them again to be saved.
12.
dataSourceItem.dirty =
false
;
13.
}
14.
if
(
this
.dataSource.hasChanges()) {
15.
//this should always be a no now.
16.
console.log(
"has changes"
);
17.
}
this.findById is digging through the kendoDataSource.data() method and returning the correct item.
How can I update the data item in the data source and have it think its the pristine saved version after the signalr update? As client 1 and 2 sort of move into a protective - only display saved changes mode once editing has started. Clicking on update on a modified row by a different client will have the correct signalr pushed values but they are not on the item display template.
Best Regards,
Matt