CSS selector in avoidLinks

8 posts, 0 answers
  1. Morten
    Morten avatar
    352 posts
    Member since:
    Jul 2012

    Posted 13 Jul 2017 Link to this post

    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)?

  2. Orlin
    Admin
    Orlin avatar
    62 posts

    Posted 17 Jul 2017 Link to this post

    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.
  3. Morten
    Morten avatar
    352 posts
    Member since:
    Jul 2012

    Posted 17 Jul 2017 in reply to Orlin Link to this post

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

  4. Orlin
    Admin
    Orlin avatar
    62 posts

    Posted 18 Jul 2017 Link to this post

    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.
  5. Morten
    Morten avatar
    352 posts
    Member since:
    Jul 2012

    Posted 18 Jul 2017 Link to this post

     

     

     

     

    http://dojo.telerik.com/iwuWAK

  6. Morten
    Morten avatar
    352 posts
    Member since:
    Jul 2012

    Posted 18 Jul 2017 in reply to Morten Link to this post

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

     

  7. Orlin
    Admin
    Orlin avatar
    62 posts

    Posted 19 Jul 2017 Link to this post

    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.
  8. Morten
    Morten avatar
    352 posts
    Member since:
    Jul 2012

    Posted 27 Jul 2017 in reply to Orlin Link to this post

    Thanks Orlin,

    nice simple solution. Works perfectly.

    Best regards Morten

     

Back to Top