3 Answers, 1 is accepted
0
Hi Suman,
In order to disable exporting when there are no records in the Kendo DataSource, use the excelExport event. It will fire when the user clicks on the export button. Then, check to see the total amount of items in the dataSource. Finally, use e.preventDefault() to prevent exporting. Optionally, you can add the alert.
For setting a message when there are no records:
Set the NoRecords property to true to display a message. If you want to customize this message, set the messages.noRecords property.
Please take a look at the following Kendo UI Dojo by Progress to see the above approaches.
I hope this helps!
Regards,
Patrick
Telerik by Progress
In order to disable exporting when there are no records in the Kendo DataSource, use the excelExport event. It will fire when the user clicks on the export button. Then, check to see the total amount of items in the dataSource. Finally, use e.preventDefault() to prevent exporting. Optionally, you can add the alert.
excelExport: function(e){
var grid = $("#grid").data("kendoGrid");
if (grid.dataSource.total() == 0){
e.preventDefault();
alert("No Records Found");
}
},
For setting a message when there are no records:
Set the NoRecords property to true to display a message. If you want to customize this message, set the messages.noRecords property.
$("#grid").kendoGrid({
...
noRecords: true,
messages:{
noRecords: "No Records Found"
},
...
});
Please take a look at the following Kendo UI Dojo by Progress to see the above approaches.
I hope this helps!
Regards,
Patrick
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which
deliver the business app essential building blocks - a grid component,
data visualization (charts) and form elements.
0
suman
Top achievements
Rank 1
answered on 16 Dec 2016, 06:58 PM
Thank you Patrick for quick reply. I created excelExport event to show alert and used preventdefault. Only problem is alerting twice. Any idea why its showing alert twice?
0
Hello Suman,
I was unable to replicate this issue. Please create a dojo or update the one from the last post replicating the behavior.
I look forward to your reply.
Regards,
Patrick
Telerik by Progress
I was unable to replicate this issue. Please create a dojo or update the one from the last post replicating the behavior.
I look forward to your reply.
Regards,
Patrick
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which
deliver the business app essential building blocks - a grid component,
data visualization (charts) and form elements.