When a new item is added and the dataSource's sync method is called, the requestEnd event handler data (arg.type) returns the type of request as "read", instead of "create".
As a result the Add new item demo, does not work as expected, because it has a check for the type of the request in the requestEnd handler, and expects the request to be "create". Since the request type comes out as "read" the logic for selecting the newly added item is not executed.
In previous versions the request has been correctly identified as "create". The issue is exhibited only in the MultiSelect. The ComboBox and the DropDownList return the request as "create".
This behavior has been introduced in R3 2017. Reproducible in Chrome, Firefox and Chromium Edge. Not reproducible in IE11 and Spartan Edge.
As a workaround the addNew function can be modified as shown below:
function addNew(widgetId, value) {
var widget = $("#" + widgetId).getKendoMultiSelect();
var dataSource = widget.dataSource;
if (confirm("Are you sure?")) {
dataSource.add({
ProductID: 0,
ProductName: value
});
dataSource.one("sync", function() {
var index = dataSource.view().length - 1;
var newValue = dataSource.at(index).ProductID;
widget.value(widget.value().concat([newValue]));
});
dataSource.sync();
}
}
Dojo example.
The event data returns "read" as the type of the request.
The event data returns "create" as the type of the request.