Durandal JS knockout-kendo kendoGrid

513 views Asked by At

Good afternoon,

I'm trying to get the kendoEditor from the knockout-kendo project (https://github.com/kendo-labs/knockout-kendo/) to work, but it keeps throwing the error 'Uncaught TypeError: Cannot read property 'body' of null'.

After a lot of debugging I got to the following lines of code (This code is taken directly from kendo.web.js):

iframe = $("<iframe />", { src: 'javascript:""', frameBorder: "0" })
    .css("display", "")
    .addClass("k-content")
    .insertBefore(textarea)[0];

wnd = iframe.contentWindow || iframe;
doc = wnd.document || iframe.contentDocument;

doc.open();
doc.write('STRIPPED FOR READABILITY');
doc.close();

In here it is trying to create an iframe which is used in the editor. See the source on (http://demos.kendoui.com/web/editor/index.html) for an example. However, iframe.contentWindow, iframe.document and iframe.contentDocument are all null. Logically, this code fails when trying to do doc.open(); and results in the aforementioned exception.

After a bit of searching StackOverflow came up with the following: Why is iframe.contentWindow == null?. There seems to be a problem with the readiness of the document.

Does someone has any idea on how to solve this? Or does anyone has experience with DurandalJS (not the new v2) and knockout-kendo?

I am using Durandal JS 1.2.0.

Thanks in advance.

EDIT

Script references to jquery, knockout and kendo ui and knockout-kendo are done via MVC Bundle.Config.

kendoEditor initialization is done via:

<textarea id="emailTemplate" data-bind="kendoEditor: content"></textarea>
0

There are 0 answers