I'm trying to set up a MultiSelectFor to be used NoDataTemplate, but the pop-up just never seems to appear. There is an HTML5 version on the site,but not one for MVC: http://demos.telerik.com/kendo-ui/multiselect/addnewitem
Here is what I have wrriten, but the template never appears
<
script
id
=
"@noDataTemplateID"
type
=
"text/x-kendo-tmpl"
>
<
div
>
No data found. Do you want to add new item - '#: instance.input.val() #' ?
</
div
>
<
br
/>
<
button
class
=
"k-button"
onclick
=
"addNew('#: instance.element[0].id #', '#: instance.input.val() #')"
>Add new item</
button
>
</
script
>
<
script
>
//the actual data won't get synced to the server, but that's okay because when we save this new item on the update of the parent model, we presumably will grab that newly added item on the next read
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("requestEnd", function (args) {
if (args.type !== "create") {
return;
}
var newValue = args.response[0].ProductID;
dataSource.one("sync", function () {
widget.value(widget.value().concat([newValue]));
});
});
dataSource.sync();
}
}
</
script
>
@(
Html.Kendo().MultiSelectFor(m => m)
.DataTextField(descriptionField)
.DataValueField(IDFIeld)
.NoDataTemplate(noDataTemplateID)
.DataSource(source =>
{
source.Read(read => {
read.Action("Read", "List", new { ListType = ListType, Param1 = Param1, Param2 = Param2, Param3 = Param3 });
})
.ServerFiltering(true);
})
)