My Home view contains a grid. When a row in the grid is clicked, a window is displayed in an iframe with a spreadsheet on it.
<div> @(Html.Kendo().Window() .Name("timecard") .Modal(true) .Actions(actions => actions.Close()) .Draggable(false) .LoadContentFrom("Timecard") .Events(events => events .Open("timecard_OnOpen") .Close("timecard_OnClose") ) .Iframe(true) .Width(1650) .Height(800) .Visible(false) .Deferred(true) )</div>
In the Open event I am using an ajax call to the controller to get data to fill the spreadsheet. Once I have the data I want to populate the spreadsheet. The spreadsheet is somewhat complex with frozen rows, merged cells, etc. so I can't use a datasource. My issue is that I cannot get access to the spreadsheet on the iFrame window to populate it with the data.
function timecard_OnOpen(e){ $.ajax({ url: '@Url.Action("Load", "Timecard")', type: 'POST', data: { id: employee_key }, success: timecard_LoadTimecardSuccess });}function timecard_LoadTimecardSuccess(data){ var window = $("#timecard").getKendoWindow(); var spreadsheet = $("#timecardSpreadsheet").data("kendoSpreadsheet");}
The var spreadsheet is undefined. I want to be able to do something like this:
var spreadsheet = $("#timecardSpreadsheet").data("kendoSpreadsheet");
var sheet = spreadsheet.activeSheet();
var range = sheet.range('B12'); // Spreadsheet cell name
range.value("TEST");