This is a migrated thread and some comments may be shown as answers.

CSS selector in avoidLinks

7 Answers 114 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Morten
Top achievements
Rank 2
Iron
Iron
Veteran
Morten asked on 13 Jul 2017, 12:50 PM

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

Sort by
0
Orlin
Telerik team
answered on 17 Jul 2017, 06:34 AM
Hello Morten,

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
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
Morten
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 17 Jul 2017, 07:38 AM

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");
            });
        }

0
Orlin
Telerik team
answered on 18 Jul 2017, 07:07 AM

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
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
Morten
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 18 Jul 2017, 07:40 AM

 

 

 

 

http://dojo.telerik.com/iwuWAK

0
Morten
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 18 Jul 2017, 10:29 AM

Please review my dojo. The buttons in the row is not removed in the pdf

 

0
Orlin
Telerik team
answered on 19 Jul 2017, 08:19 AM

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
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
Morten
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 27 Jul 2017, 08:20 AM

Thanks Orlin,

nice simple solution. Works perfectly.

Best regards Morten

 

Tags
Grid
Asked by
Morten
Top achievements
Rank 2
Iron
Iron
Veteran
Answers by
Orlin
Telerik team
Morten
Top achievements
Rank 2
Iron
Iron
Veteran
Share this question
or