I have a grid with a button in each row.
Exporting to PDF I would like to exclude these buttons.
Is this possible?
In the documentation for pdf.avoidLinks (http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#configuration-pdf.avoidLinks) it reads: "It's also possible to pass a CSS selector as argument. All matching links will be ignored.".
Does this css selector only match links (<a> elements)?
7 Answers, 1 is accepted
The pdf.avoidLinks option makes the links in the PDF clickable or non-clickable and does not really remove them from the exported PDF.
The Grid does not have a built-in functionality to remove certain elements on export but you can have a look at this forum thread (http://www.telerik.com/forums/how-to-hide-column-while-export) for a solution to a similar problem - the removal of columns on export.
I hope that helps.
Regards,
Orlin
Progress Telerik
Hello Orlin
thanks for your answer. I'm trying to add the class "hidden" to the buttons in the pdfExport as below, however the buttons still appear on the pdf. What am I doing wrong?
pdfExport: function (e) {
var buttons = $(".btn");
buttons.addClass("hidden");
e.promise.done(function () {
buttons.removeClass("hidden");
});
}
Hello Morten,
At first glance your code snippet looks correct. However make sure your buttons have class btn otherwise it would not work.
I have created a dojo with a similar scenario – it hides the button on pdfExport and shows it when the process is finished. You can find it here: http://dojo.telerik.com/acOzar
I hope this helps.
Regards,
Orlin
Progress Telerik
http://dojo.telerik.com/iwuWAK
Please review my dojo. The buttons in the row is not removed in the pdf
Hello Morten,
Yes, the buttons are still in the PDF. In this case, a different approach to the same problem is to use CSS. The PDF export adds a k-pdf-export class, and that can be used to hide the buttons. Have a look at the following dojo for a demonstration of this method: http://dojo.telerik.com/iwuWAK/2
I hope this helps.
Regards,
Orlin
Progress Telerik
Thanks Orlin,
nice simple solution. Works perfectly.
Best regards Morten