jQWidgets Forums

jQuery UI Widgets Forums Grid Grid Printing

This topic contains 5 replies, has 4 voices, and was last updated by  admin 5 years, 2 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • Grid Printing #57668

    Develop101
    Participant

    Hi,

    Is there a away to only print out the columns that are visible? We have several columns hidden for reference purposes and would like these to not print out.

    I have followed the example on how to print the grid using the exportdata function. This all works fine apart from the the printing of hidden columns.

    Is there also a way to print out only the selected rows?

    Cheers

    Grid Printing #57670

    Peter Stoev
    Keymaster

    Hi TCRNottingham,

    1. If you don’t want to print(export) a column, set its “exportable” property to false.
    2. If you want to export a custom array of rows, call the exportdata method and pass the Array of rows which you want to export. You can use the Grid’s API for getting the selected rows. Useful methods for your task are “getselectedrowindexes” which returns the bound indexes of the selected rows and “getboundrows” which returns an array of all data bound rows. Having the indexes of the selected rows, you can easily build the array of the selected rows as a sub set of the “getboundrows” result which is an Array, too.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

    Grid Printing #57698

    Develop101
    Participant

    Hi Peter,

    Thanks for the response. Is there an example of this anywhere? I keep getting undefined when I pass the array of indexes into the export data function.

    
    var gridContent;
    var selectedrowindexes = $('#baseline').jqxGrid('selectedrowindexes');
    if (selectedrowindexes.length > 0) {
        gridContent = $("#baseline").jqxGrid('exportdata', 'html', 'datauri', true, selectedrowindexes);
    } else {
        gridContent = $("#baseline").jqxGrid('exportdata', 'html');
    }
    

    Best Regards
    TCRNottingham

    Grid Printing #57718

    Peter Stoev
    Keymaster

    Hi TCRNottingham,

    Sorry, we don’t have such example available.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

    Grid Printing #111875

    ronak
    Participant

    hi, there is any way to pass custom array for the print documents. because the above solution is to return the undefined result. I want to print only the checkbox check rows. please help

    Grid Printing #111880

    admin
    Keymaster

    Hi ronak,

    The 4th param of exportdata is an array of rows. To get all grid rows, you can use the “getrows” method. It returns an array.You can slice it and pass it to the exportdata method in order to print only the necessary rows.

    Regards,
    Peter

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.