Our customers like to take data from the grid, and put it in editors like notepad, excel, word or others...
Is there a way to copy the visible, or, all, the grid data to clipboard, as tab separated values? as in the attached picture
4 Answers, 1 is accepted
Hi Serge,
The recommended way of exporting Grid data to Excel is by using the internal Excel export functionality.
Nevertheless, you can also select all Grid data and copy it to the clipboard with some custom logic. For example:
$(document).ready(function () {
$("#selectAll").click(function () {
var grid = $("#grid").data("kendoGrid")
grid.select(grid.tbody.find(">tr td"));
grid.copySelection(grid);
document.execCommand("copy");
});
Here is a small Dojo demo I prepared demonstrating this:
The logic for selecting and copying the data is also valid for Html Helper Grid.
Let me know if yo have any questions.
Regards,
Nikolay
Progress Telerik
Тhe web is about to get a bit better!
The Progress Hack-For-Good Challenge has started. Learn how to enter and make the web a worthier place: https://progress-worthyweb.devpost.com.
Hello, Nikolay
I tested your example, it does a mix between copying the visible data and available data.... I mean, it copies more than visible, but less than all data...
Hi Serge,
This can be achieved by enabling the Grid property AllowCopy which will allow the user could copy the selection into the clipboard and paste it into Excel or other similar programs that understand TSV/CSV formats.
Here is a working example you can test:
Regards,
Nikolay
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.