I have the following set up:
var documentListDataSource = new kendo.data.DataSource({
transport: {
read: function (options) {
debugger;
var fnum = editData != null ? editData.Number : '';
var vrid = editData != null ? editData.FormVersionId : 0;
$.ajax({
url: '@Url.Action("GetFormDocumentList", "Form")',
dataType: "json",
async: false,
type: "POST",
data: { formNumber: fnum, formVersionId: vrid },
success: function (data) {
options.success(data);
}
});
}
}
});
function initDocumentGrid() {
$("#DocumentGrid").kendoGrid({
dataSource: documentListDataSource,
navigatable: true,
selectable: "row",
columns: [{
field: "Format",
title: "Format",
width: 150
}, {
field: "Name",
title: "File Name",
width: 150
}, {
title: "Actions",
template: function (dataItem) {
return BuildDocumentActionButtons(dataItem);
}
}]
});
}
function BuildDocumentActionButtons(dataItem) {
var retval = '';
if (dataItem.Extension == "xpd") {
// interactive mapping button
//retval += "<button class='k-button k-button-icontext' onclick='OpenMappingWindow();'>Conversion Map</button>"
}
if (retval.length > 0) retval += ' ';
// upload document button - always rendered
retval += "<button class='k-button k-button-icontext' onclick='OpenUploadWindow(" + datItem.Extension + ");'>Upload</button>"
//if (dataItem.Name != "") {
// retval += ' ';
// // toggle availability button
// retval += "<button class='k-button k-button-icontext' onclick='ToggleAvailability(" + datItem.Name + ");'>Availability</button>"
// retval += ' ';
// // remove document button
// retval += "<button class='k-button k-button-icontext' onclick='RemoveDocument(" + datItem.Name + ");'>Remove</button>"
//}
return retval;
}
When retval returns button definitions, the following call fails with no error:
$("#DocumentGrid").data("kendoGrid").dataSource.read();
I am doing something wrong, but am missing it.
Any assistance would be most appreciated.