Hi All,
I have a page with grid and command button that popup a kendoWindow (partial view) and parent viewModel is passed to the partial view. Inside the kendoWindow, there is another grid which the user can select and delete the row. The partial view and script below always give me this error 'TypeError: Cannot read property 'value' of undefined' and I can't figure out why. Is there a way to solve this issue? and applying kendo.bind in the partial view(the javascript below) cause more problems.
HTML
<div id="notes-dialog" title="Notes" style="display: none">
<div id="grid"></div>
</div>
Javascript
function display() {
ds = new kendo.data.DataSource({
pageSize: 20,
data: viewModel.CurrentlyDisplayedNotes,
autoSync: true,
schema: {
model: {
id: "Id",
fields: {
Id:{editable: false},
Notes: { editable: true, type:"string" }
}
}
}
});
var gridNotes = $("#grid").kendoGrid({
dataSource: ds,
pageable: true,
resizable: true,
height: 365,
toolbar: [{ text: "Add", click: addNote }],
columns: [
{
field: "Notes", title: "Notes"
},
{ command: { text: "Delete", click: removeNote }, title: " ", width: "180px" }],
editable: true
}).data("kendoGrid");
function removeNote() {
var grid = $("#grid").data("kendoGrid");
var sel = grid.select(); // Error here: TypeError: Cannot read property 'value' of undefined
var item = grid.dataItem(sel);
// other code goes here
};
function addNote() {
var grid = $("#grid").data("kendoGrid");
var item = grid.dataItem( grid.select()); // Error here: TypeError: Cannot read property 'value' of undefined
//more code below
}
TIA