|
How I can select Field Chooser like option in Grid Grouping Control, so that we can Select the Field to show/hide and as per the same we can export to pdf/excel.. |
Currently SfDataGrid control does not have support for the Column chooser. We have added this feature to our feature request list. This will be available in our upcoming 2018 Volume 3 release which is expected to be rolled out in Mid of September (2018). |
|
If Field is selected as Hidden field, then the same field will not export to pdf/excel format. |
The hidden columns from the column chooser will be exported by default. The hidden columns should be added to the Exclude property of PdfExportingOptions and ExcelExportingOptions.
We have provided the UG for excluding the columns from exporting. Please refer the below UG,
Code example
Excel exporting
ExcelExportingOptions options = new ExcelExportingOptions();
foreach (var columns in sfDataGrid1.Columns)
{
if (!columns.Visible)
options.ExcludeColumns.Add(columns.MappingName);
}
var document = sfDataGrid1.ExportToPdf(sfDataGrid.View, options);
PDF exporting
PdfExportingOptions options = new PdfExportingOptions();
foreach (var columns in sfDataGrid1.Columns)
{
if (!columns.Visible)
options.ExcludeColumns.Add(columns.MappingName);
}
var document = sfDataGrid1.ExportToPdf(options);
|
|
//Attach the column chooser popup to the sfdatagrid.
ColumnChooserPopup columnChooserPopup = new Syncfusion.WinForms.DataGrid.Interactivity.ColumnChooserPopup(sfDataGrid);
columnChooserPopup.Show();
// Add column chooser as control
ColumnChooser columnChooser = new Syncfusion.WinForms.DataGrid.Interactivity.ColumnChooser(this.sfDataGrid);
columnChooser.Location = new Point(780, 120);
this.Controls.Add(columnChooser); |