3 Answers, 1 is accepted
Hi Michael,
We have a dedicated KB article to Export the Checked Columns in the Kendo UI Grid to Excel.
As you have mentioned that the selection is based on a column value, please use the dataBound event to check the column in the Dojo sample of the KB article. For example:
$("#grid").kendoGrid({
dataBound: function() {
var view = this.dataSource.view();
this.items().each(function(index, row) {
if(view[index].category === "Food") // Selects the row if the Catergory is Food.
view[index].check = true;
else
view[index].check = false;
kendo.bind(row, view[index]);
});
}
});
Bind the check value with the checkbox in the columns.template property as seen below:
$("#grid").kendoGrid({
columns: [
{ template: "<input type='checkbox' data-bind='checked: check'/>" }
]
});
In this Dojo example, the Grid selects the rows with the Category 'Food' and exports them to Excel.
Please let me know if this helps. If I have misunderstood your query, could you respond with a detailed explanation? I will further help you with the modification.
Regards,
Hetali
Progress Telerik
Hi Team,
I am using Angular with KendoGrid .I have to upload only when the records are selected by check box otherwise it will not export to all the records to excel .Can some one help me by provide the right links or suitable code for resolving this issue with working code .
Thanks and Regards,
Kamaraj.P
Hello Kamaraj,
In order to export specific data in excel format, please check the following article from our documentation:
https://www.telerik.com/kendo-angular-ui/components/grid/export/excel-export/#exporting-specific-data
The [fetchData] callback returns the collection that will be exported. Apply the state of the Grid in fetchData callback function.
Regarding the selection the most straight-forward approach to keep an automatically updated collection of all selected Grid rows is via the kendoGridSelectBy directive and the selectedKeys (which will be bound to the actual collection of selected Grid items):
https://www.telerik.com/kendo-angular-ui/components/grid/selection/persisting/#persisting-the-row-selection
The fetchData callback can return the collection of selected items. Please check the following example:
https://stackblitz.com/edit/angular-7ugysd-hl7naz?file=app/app.component.ts
I hope this helps.
Regards,
Martin
Progress Telerik
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/.