Grid Export
FdcGridExportButton integrates the grid toolbar with the FDC export pipeline.
FdcGridToolbar(
items: [
FdcGridExportButton(
visible: true,
placement: FdcGridItemPlacement.end,
scope: FdcExportScope.currentView,
columnMode: FdcGridExportColumnMode.visibleColumns,
onExport: (result) {
// Download, save, or share result.bytes.
},
),
],
)
The button generates an FdcExportResult. Saving or sharing remains application-controlled and platform-specific.
Column modes
The default mode is:
columnMode: FdcGridExportColumnMode.visibleColumns
This exports:
- visible grid columns only,
- data-bound columns only,
- columns whose
exportablesetting allows export, - current runtime grid order,
- current column labels,
- grid value formatters for presentation-oriented writers,
- right alignment metadata for decimal columns.
This is usually the correct choice for a user-facing Export current grid command.
Use dataset field order instead:
columnMode: FdcGridExportColumnMode.dataSetFields
In that mode, column resolution is delegated to FdcExporter; grid visibility and column reordering do not define the exported schema.
Row scope
FdcGridExportButton(
scope: FdcExportScope.selectedRows,
onExport: handleExport,
)
The same scopes are available as direct dataset export: all rows, current view, selected rows, current row, and changed rows.
See Exporting DataSets for exact semantics.
Value mode
FdcGridExportButton(
valueMode: FdcExportValueMode.display,
onExport: handleExport,
)
Use display when user-visible text is the priority. Use raw when the target writer should preserve types where possible.
Visible-column grid export additionally supplies column-specific value formatters. Presentation writers such as PDF consume those formatters to keep formatted dates, decimal presentation, prefixes, and suffixes aligned with the grid where supported.
Format menu
The Community formats are available by default:
formats: const [
FdcExportFormat.csv,
FdcExportFormat.json,
FdcExportFormat.xml,
]
Registered extension formats are added to the effective menu automatically. After FdcPro.ensureInitialized(), the Pro Excel and PDF formats are therefore also available to the export menu.
You can still explicitly control the base list:
FdcGridExportButton(
formats: const [
FdcExportFormat.csv,
FdcPdfExportFormat.pdf,
],
onExport: handleExport,
)
Per-format writer options
Writer-specific configuration is supplied by format:
FdcGridExportButton(
writerOptions: const {
FdcPdfExportFormat.pdf: FdcPdfExportOptions(
orientation: FdcPdfOrientation.landscape,
wrapText: true,
maxCellLines: 3,
),
},
onExport: handleExport,
)
Cross-format behavior such as scope and value mode belongs directly on FdcGridExportButton; format-specific document behavior belongs in writerOptions.
Application export styles
Grid export resolves inherited style defaults from the nearest FdcApp:
FdcApp(
exportStyle: FdcExportStyle(
pdf: FdcPdfExportStyle(
fontSize: 9,
showGrid: false,
),
),
child: const OrdersPage(),
)
A per-export style inside FdcPdfExportOptions.style overrides the inherited application style.
See PDF Export.
Availability during editing
The built-in export command requires an open dataset with records and no active dataset edit. This prevents a toolbar export from silently serializing an unresolved in-progress edit state.