Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
Scenario A page with a Grid and a Editor, and the Editor could get the data from the Grid by clicking Custom Tool Button or something else, after the data were generated on the Editor, I'll export it into files(pdf / excel etc.) Is the "getting data from grid" idea possible? Or Is there a limitation?
Mihaela
Telerik team
commented on 06 Jan 2022, 01:39 PM
Indeed, you could get the grid's data by accessing its dataSource. For example:
.CustomButton(x => x.Name("custom").ToolTip("Insert a grid data").Exec(@<text>
function(e) {
var editor = $(this).data("kendoEditor");
var grid = $("#grid").data("kendoGrid"); //get an instance of the gridvar gridData = grid.dataSource.view(); //use the view() method of the DataSource to get the data items which correspond to the current page. Alternatively, call the data() method, which will return the data items from all pages, if local data binding and paging are used.
editor.value("name:" + gridData[0].name); //insert the value of the Model property "name" of the first data item. You could loop through all data items and extract the desired data
}
</text>))