Remove Columns in PDF Export

Hi,
 
I want to remove some columns that are visible in the Grid, so that they do not appear in the exported pdf. Is this possible?
 
Regards, Stefan

1 Reply

ES Eswari S Syncfusion Team September 18, 2012 07:27 AM UTC

Hi Stefan,

Thank you for using Syncfusion products.

Query #: Remove Columns in PDF Export

splice() method adds/removes items to/from an array, and returns the removed item. In exporting , we have remove the specified column from VisibleColumns collection and after exporting we have restored the column into the grid using setTimeout function in OnToolbarClickEvent. Please refer to the following code snippets:

function begin(sender, args) {
            var gridObj = $find("SampleGrid");
            var visible = gridObj.get_VisibleColumns();
 
            window.tempDelete = [visible, visible.splice(0, 1)];
 
            window.setTimeout(function () {
 
                window.tempDelete[0].splice(0, 0, window.tempDelete[1][0]);
 
            }, 0);
        }

We have prepared the sample for your requirement and the same can be downloaded from the following link:

http://www.syncfusion.com/downloads/Support/DirectTrac/95502/Sample1852111117.zip

Please try this and let us know if you have any other queries.

Regards,
Eswari S


Loader.
Up arrow icon