jQuery UI Widgets Forums Grid changing column width after exporting html from jqgrid

This topic contains 1 reply, has 2 voices, and was last updated by  Dimitar 10 years, 1 month ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author

  • sainish
    Participant

    I am printing content by exporting grid .
    the problem is i want to change column width when sending grid html content for print.


    Dimitar
    Participant

    Hello sainish,

    You can change the width before printing and revert it to its previous value afterwards with the setcolumnproperty method, e.g.:

    $("#print").click(function() {
        $('#jqxgrid').jqxGrid('setcolumnproperty', 'firstname', 'width', 90);
        var gridContent = $("#jqxgrid").jqxGrid('exportdata', 'html');
        $('#jqxgrid').jqxGrid('setcolumnproperty', 'firstname', 'width', 120);
        var newWindow = window.open('', '', 'width=800, height=500'),
            document = newWindow.document.open(),
            pageContent =
            '<!DOCTYPE html>\n' +
            '<html>\n' +
            '<head>\n' +
            '<meta charset="utf-8" />\n' +
            '<title>jQWidgets Grid</title>\n' +
            '</head>\n' +
            '<body>\n' + gridContent + '\n</body>\n</html>';
        document.write(pageContent);
        document.close();
        newWindow.print();
    });

    Best Regards,
    Dimitar

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

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

You must be logged in to reply to this topic.