Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access the options of a kendo grid inside an iframe from outside?

I am working in a web application using kendo grid.I've an iframe which contains kendo grid and need to access the kendo options from outside using jquery.

Yeah I tried to access the element using below code

Iframe.contentWindow.find....this code returns the element but when I try to extend this to kendo element (element.data("kendoGrid") ) it shows undefined.Any help?

like image 489
ARUNRAJ Avatar asked Oct 19 '22 06:10

ARUNRAJ


1 Answers

You tried to find the element using the iframe.contentWindow (which is right), but you didn't use the jQuery object of the iframe instead of the main window jQuery object.

You can access it this way:

var framejQuery = $('#frameID')[0].contentWindow.$;
var element = $('#frameID').contents().find('#gridID')[0];
var grid = framejQuery.data(element, 'kendoGrid');         // Here's your grid object
like image 168
Ahmad Ibrahim Avatar answered Oct 31 '22 21:10

Ahmad Ibrahim