ExportDialog

Dialog window used by the PDF export feature. It allows users to select export options like paper format and columns to export. This dialog contains a number of predefined fields which you can access through the popup's widgetMap.

Default widgets

The default widgets of this dialog are:

Widget ref Type Weight Description
columnsField Combo 100 Choose columns to export
rowsRangeField Combo 200 Choose which rows to export
exporterTypeField Combo 300 Type of the exporter to use
alignRowsField Checkbox 400 Align row top to the page top on every exported page
repeatHeaderField Checkbox 500 Toggle repeating headers on / off
fileFormatField Combo 600 Choose file format
paperFormatField Combo 700 Choose paper format
orientationField Combo 800 Choose orientation

The default buttons are:

Widget ref Type Weight Description
exportButton Button 100 Triggers export
cancelButton Button 200 Cancel export

Bottom buttons may be customized using bbar config passed to exportDialog:

const grid = new Grid({
    features : {
        pdfExport : {
            exportDialog : {
                bbar : {
                    items : {
                        exportButton : { text : 'Go!' }
                    }
                }
            }
        }
    }
});

Configuring default widgets

Widgets can be customized with exportDialog config:

const grid = new Grid({
    features : {
        pdfExport : {
            exportDialog : {
                items : {
                    // hide the field
                    orientationField  : { hidden : true },

                    // reorder fields
                    exporterTypeField : { weight : 150 },

                    // change default format in exporter
                    fileFormatField   : { value : 'png' }
                }
            }
        }
    }
});

grid.features.pdfExport.showExportDialog();

Configuring default columns

By default all visible columns are selected in the export dialog. This is managed by the autoSelectVisibleColumns config. To change default selected columns you should disable this config and set field value. Value should be an array of valid column ids (or column instances). This way you can preselect hidden columns:

const grid = new Grid({
    columns : [
        { id : 'name', text : 'Name', field : 'name' },
        { id : 'age', text : 'Age', field : 'age' },
        { id : 'city', text : 'City', field : 'city', hidden : true }
    ],
    features : {
        pdfExport : {
            exportDialog : {
                autoSelectVisibleColumns : false,
                items : {
                    columnsField : { value : ['name', 'city'] }
                }
            }
        }
    }
})

// This will show export dialog with Name and City columns selected
// even though City column is hidden in the UI
grid.features.pdfExport.showExportDialog();

Adding fields

You can add your own fields to the export dialog. To make such field value acessible to the feature it should follow a specific naming pattern - it should have ref config ending with Field, see other fields for reference - orientationField, columnsField, etc. Fields not matching this pattern are ignored. When values are collected from the dialog, Field part of the widget reference is removed, so orientationField becomes orientation, fooField becomes foo, etc.

const grid = new Grid({
    features : {
        pdfExport : {
            exportDialog : {
                items : {
                    // This field gets into export config
                    fooField : {
                        type : 'text',
                        label : 'Foo',
                        value : 'FOO'
                    },

                    // This one does not, because name doesn't end with `Field`
                    bar : {
                        type : 'text',
                        label : 'Bar',
                        value : 'BAR'
                    },

                    // Add a container widget to wrap some fields together
                    myContainer : {
                        type : 'container',
                        items : {
                            // This one gets into config too despite the nesting level
                            bazField : {
                                type : 'text',
                                label : 'Baz',
                                value : 'BAZ'
                            }
                        }
                    }
                }
            }
        }
    }
});

// Assuming export dialog is opened and export triggered with default values
// you can receive custom field values here
grid.on({
    beforePdfExport({ config }) {
        console.log(config.foo) // 'FOO'
        console.log(config.bar) // undefined
        console.log(config.baz) // 'BAZ'
    }
});

Configuring widgets at runtime

If you don't know column ids before grid instantiation or you want a flexible config, you can change widget values before dialog pops up:

const grid = new Grid({
    columns : [
        { id : 'name', text : 'Name', field : 'name' },
        { id : 'age', text : 'Age', field : 'age' },
        { id : 'city', text : 'City', field : 'city', hidden : true }
    ],
    features : {
        pdfExport : true
    }
});

// Such listener would ignore autoSelectVisibleColumns config. Similar to the snippet
// above this will show Name and City columns
grid.features.pdfExport.exportDialog.on({
    beforeShow() {
        this.widgetMap.columnsField.value = ['age', 'city']
    }
});

Configs

124

Common

listenersEvents

Other

Set to false to not preselect all visible columns when the dialog is shown

Grid instance to build export dialog for

Set to false to allow using PNG + Multipage config in export dialog

When set to true labels in the dialog will say Print instead of Export

columnWidget
defaultFocusContainer
drawerPanel
labelPositionContainer
modalPopup
renditionContainer
resizableResizable
rtlRTL
spanWidget

Accessibility

ariaLabelWidget
keyMapKeyMap

Content

bbarPanel
defaultsContainer
footerPanel
headerPanel
itemsContainer
lazyItemsContainer
namedItemsContainer
stripsPanel
tbarPanel
textContentContainer
toolsPanel

CSS

bodyClsPanel
borderContainer
clsWidget
colorWidget
htmlClsWidget
itemClsContainer
styleWidget
uiPanel

DOM

adoptWidget
appendToWidget
contentWidget
datasetWidget
htmlWidget
idWidget
tagWidget

Float & align

alignWidget
anchorWidget
centeredWidget
floatingWidget
xWidget
yWidget

Layout

alignSelfWidget
dockWidget
flexWidget
heightWidget
hiddenWidget
hideWhenEmptyContainer
layoutContainer
layoutStyleContainer
marginWidget
maxHeightWidget
maxWidthWidget
minHeightWidget
minWidthWidget
textAlignWidget
weightWidget
widthWidget

misc

tabBarItemsContainer

Misc

dataFieldWidget
disabledWidget
iconPanel
localeClassLocalizable
localizableLocalizable
maskedWidget
ownerWidget
readOnlyWidget
refWidget
rippleWidget
tabWidget
titlePanel
tooltipWidget

Record

recordContainer

Scrolling

State

stateIdState

Properties

99

Class hierarchy

isExportDialog: Boolean= truereadonly
Identifies an object as an instance of ExportDialog class, or subclass thereof.
isExportDialog: Boolean= truereadonlystatic
Identifies an object as an instance of ExportDialog class, or subclass thereof.
isContainerContainer
isDelayableDelayable
isEventsEvents
isKeyMapKeyMap
isLocalizableLocalizable
isPanelPanel
isPopupPopup
isResizableResizable
isStateState
isToolableToolable
isWidgetWidget

Other

When set to true labels in the dialog will say Print instead of Export

values: Object<String, Object>readonly

Returns map of values of dialog fields.

$namestaticWidget
columnWidget
firstItemContainer
hasChangesContainer
isValidContainer
itemsContainer
labelPositionContainer
lastItemContainer
renditionContainer
resizableResizable
rtlRTL
spanWidget
toolsPanel
typestaticWidget

Accessibility

keyMapKeyMap

Content

bbarPanel
tbarPanel

CSS

clsWidget

DOM

appendToWidget
contentWidget
datasetWidget
elementWidget
htmlWidget
idWidget
styleWidget

Float & align

xWidget
yWidget

Layout

alignSelfWidget
flexWidget
heightWidget
layoutContainer
layoutStyleContainer
marginWidget
maxHeightWidget
maxWidthWidget
minHeightWidget
minWidthWidget
widthWidget

Lifecycle

configBase

Misc

cellInfoWidget
disabledWidget
localeHelperLocalizable
localeManagerLocalizable
readOnlyWidget
refWidget
tabWidget
titlePanel
tooltipWidget

Record

recordContainer

State

stateState

Visibility

hiddenWidget
isVisibleWidget

Widget hierarchy

ownerWidget
parentWidget
widgetMapContainer

Functions

75

Configuration

applyDefaultsstaticBase

Events

Float & align

alignToWidget
setXYWidget
showByWidget
toFrontWidget

Lifecycle

createstaticWidget
destroystaticBase
initClassstaticWidget

Misc

attachTooltipstaticWidget
fromElementstaticWidget
fromSelectorstaticWidget
getByIdstaticWidget
isOfTypeNamestaticBase
mixinstaticBase
optionalLstaticLocalizable

Other

addContainer
closePopup
composeWidget
createOnFrameDelayable
disableWidget
enableWidget
focusWidget
getAtContainer
getWidgetByIdContainer
insertContainer
LstaticLocalizable
maskWidget
onEvents
recomposeWidget
relayAllEvents
removeContainer
removeAllContainer
resetValuesContainer
setValuesContainer
triggerEvents
unEvents
unmaskWidget

State

Visibility

hideWidget
showWidget

Widget hierarchy

closestWidget
containsWidget
ownsWidget
queryWidget
queryAllWidget
upWidget

Events

24

Fires when cancel button is clicked. Popup will hide itself.

// Adding a listener using the "on" method
exportDialog.on('cancel', ({  }) => {

});

Fires when export button is clicked

// Adding a listener using the "on" method
exportDialog.on('export', ({ values }) => {

});
ParameterTypeDescription
valuesObject

Object containing config for export() method

catchAllEvents
destroyEvents
expandPanel
focusInWidget
focusOutWidget
hideWidget
paintWidget
readOnlyWidget
recomposeWidget
resizeWidget
showWidget

Event handlers

24

Called when cancel button is clicked. Popup will hide itself.

new ExportDialog({
    onCancel({  }) {

    }
});

Called when export button is clicked

new ExportDialog({
    onExport({ values }) {

    }
});
ParameterTypeDescription
valuesObject

Object containing config for export() method

onDestroyEvents
onFocusInWidget
onHideWidget
onPaintWidget
onResizeWidget
onShowWidget

Typedefs

7

CSS variables

60