Class kartik\export\ExportMenu

Inheritancekartik\export\ExportMenu » kartik\grid\GridView » yii\grid\GridView » yii\widgets\BaseListView » yii\base\Widget » yii\base\Component » yii\base\BaseObject
Implementskartik\base\BootstrapInterface, kartik\grid\GridViewInterface, yii\base\Configurable, yii\base\ViewContextInterface
Uses Traitskartik\base\BootstrapTrait, kartik\base\TranslationTrait, kartik\grid\GridViewTrait

ExportMenu widget allows exporting tabular structure data to various formats using the PhpSpreadsheet library. The widget extends the kartik\grid\GridView widget, and reads the source data via a $dataProvider very similar to the kartik\grid\GridView.

For example,

use kartik\export\ExportMenu;
$gridColumns = [
    ['class' => 'yii\grid\SerialColumn'],
    'id',
    'name',
    'color',
    'publish_date',
    'status',
    ['class' => 'yii\grid\ActionColumn'],
];

// Renders a export dropdown menu
echo ExportMenu::widget([
    'dataProvider' => $dataProvider,
    'columns' => $gridColumns,
    'clearBuffers' => true, //optional
]);

// You can choose to render your own GridView separately
echo \kartik\grid\GridView::widget([
    'dataProvider' => $dataProvider,
    'filterModel' => $searchModel,
    'columns' => $gridColumns
]);

See also https://phpspreadsheet.readthedocs.io/en/latest/.

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$afterFooter array|string Configuration of additional footer table rows that will be rendered after the default grid footer row. kartik\grid\GridViewTrait
$afterHeader array|string Configuration of additional header table rows that will be rendered after default grid header row. kartik\grid\GridViewTrait
$afterRow Closure An anonymous function that is called once AFTER rendering each data model. yii\grid\GridView
$afterSaveView string|boolean The view file to show details of exported file link. kartik\export\ExportMenu
$asDropdown boolean Whether to render the export menu as bootstrap button dropdown widget. kartik\export\ExportMenu
$autoIdPrefix string The prefix to the automatically generated widget IDs. yii\base\Widget
$autoWidth boolean Whether to auto-size the excel output column widths. kartik\export\ExportMenu
$autoXlFormat boolean Determines whether the exported EXCEL cell data will be automatically guessed and formatted based on kartik\grid\DataColumn::$format property. kartik\grid\GridViewTrait
$batchSize integer Fetch models from the dataprovider using batches of this size. kartik\export\ExportMenu
$beforeFooter array|string Configuration of additional footer table rows that will be rendered before the default grid footer row. kartik\grid\GridViewTrait
$beforeHeader array|string Configuration of additional header table rows that will be rendered before the default grid header row. kartik\grid\GridViewTrait
$beforeRow Closure An anonymous function that is called once BEFORE rendering each data model. yii\grid\GridView
$behaviors yii\base\Behavior[] List of behaviors attached to this component. yii\base\Component
$bootstrap boolean Whether the grid view will have Bootstrap table styling. kartik\grid\GridViewTrait
$bordered boolean Whether the grid will have a bordered style. kartik\grid\GridViewTrait
$boxStyleOptions array The output style configuration options for the entire spreadsheet box range. kartik\export\ExportMenu
$bsColCssPrefixes array The bootstrap grid column css prefixes mapping, the key is the bootstrap versions, and the value is an array containing the sizes and their corresponding grid column css prefixes. kartik\base\BootstrapTrait
$bsCssMap array CSS conversion mappings across bootstrap library versions. kartik\base\BootstrapTrait
$bsExtBasename integer The yii2 bootstrap extension base name (readonly property available via getter method getBsExtBasename()) kartik\base\BootstrapTrait
$bsVer integer Bootstrap version number currently set (readonly property available via getter method getBsVer()) kartik\base\BootstrapTrait
$bsVersion integer|string The bootstrap library version that you wish to use for this specific extension / widget. kartik\base\BootstrapTrait
$caption string The caption of the grid table yii\grid\GridView
$captionOptions array The HTML attributes for the caption element. yii\grid\GridView
$clearBuffers boolean Whether to clear all previous / parent buffers. kartik\export\ExportMenu
$colSelFlagParam string The column selector flag parameter for export form kartik\export\ExportMenu
$columnBatchToggleSettings array The settings for the toggle all checkbox to check / uncheck the columns as a batch. kartik\export\ExportMenu
$columnSelector array The configuration of the column names in the column selector. kartik\export\ExportMenu
$columnSelectorMenuOptions array The HTML attributes for the column selector menu list. kartik\export\ExportMenu
$columnSelectorOptions array The HTML attributes for the column selector dropdown button. kartik\export\ExportMenu
$columns array Grid column configuration. yii\grid\GridView
$condensed boolean Whether the grid will have a condensed style. kartik\grid\GridViewTrait
$container \kartik\export\array, HTML attributes for the container to wrap the widget. kartik\export\ExportMenu
$containerOptions array|boolean The HTML attributes for the grid container. kartik\grid\GridViewTrait
$contentAfter array An array of rows to append after the footer row. kartik\export\ExportMenu
$contentBefore array An array of rows to prepend in front of the grid used to create things like a title. kartik\export\ExportMenu
$counter integer A counter used to generate $id for widgets. yii\base\Widget
$dataColumnClass string The default data column class if the class name is not explicitly specified when configuring a data column. yii\grid\GridView
$dataProvider yii\data\DataProviderInterface The data provider for the view. yii\widgets\BaseListView
$dataValidation array|null Data for creating excel data validation. kartik\export\ExportMenu
$defaultBtnCss string Default bootstrap button CSS (readonly property available via getter method getDefaultBtnCss()) kartik\base\BootstrapTrait
$defaultIconPrefix string Default icon prefix (readonly property available via getter method getDefaultIconPrefix()) kartik\base\BootstrapTrait
$defaultPagination string The default pagination that will be read by toggle data. kartik\grid\GridViewTrait
$deleteAfterSave boolean Whether to delete file after saving file to $folder and when $stream is false. kartik\export\ExportMenu
$disabledColumns array The column indexes for export that will be disabled for selection in the column selector. kartik\export\ExportMenu
$docProperties array The \PhpOffice\PhpSpreadsheet\Spreadsheet document properties kartik\export\ExportMenu
$dropdownClass string Bootstrap dropdown class name based on currently configured bootstrap version (readonly property available via getter method getDropdownClass()) kartik\base\BootstrapTrait
$dropdownOptions array The HTML attributes for the export button menu. kartik\export\ExportMenu
$dynagrid boolean Enable dynagrid for column selection. kartik\export\ExportMenu
$dynagridOptions array Dynagrid widget options. kartik\export\ExportMenu
$editedRowConfig array The configuration for the row being currently edited kartik\grid\GridViewTrait
$emptyCell string The HTML display when the content of a cell is empty. yii\grid\GridView
$emptyText string|false The HTML content to be displayed when $dataProvider does not have any data. yii\widgets\BaseListView
$emptyTextOptions array The HTML attributes for the emptyText of the list view. yii\widgets\BaseListView
$enableAutoFormat boolean Enable or disable cell formatting by auto detecting the grid column alignment and format. kartik\export\ExportMenu
$enableEditedRow boolean Whether to enable focused edited row feature kartik\grid\GridViewTrait
$enableFormatter boolean Whether to enable the yii gridview formatter component. kartik\export\ExportMenu
$encoding string Encoding for the downloaded file header. kartik\export\ExportMenu
$export array|boolean The grid export menu settings. kartik\grid\GridViewTrait
$exportColsParam string The export columns input parameter for export form kartik\export\ExportMenu
$exportColumnsView string The view file for rendering the columns selection kartik\export\ExportMenu
$exportConfig array The export configuration. kartik\export\ExportMenu
$exportContainer array The HTML attributes for the export button group container. kartik\grid\GridViewTrait
$exportConversions array Conversion of defined patterns in the grid cells as a preprocessing before the gridview is formatted for export. kartik\grid\GridViewTrait
$exportFormHiddenInputs array The configuration of additional hidden inputs that will be rendered with the export form. kartik\export\ExportMenu
$exportFormOptions array The HTML attributes for the export form. kartik\export\ExportMenu
$exportFormView string The view file for rendering the export form. kartik\export\ExportMenu
$exportRequestParam string The request parameter ($_GET or $_POST) that will be submitted during export. kartik\export\ExportMenu
$exportType string The data output format type. kartik\export\ExportMenu
$exportTypeParam string The export type input parameter for export form kartik\export\ExportMenu
$filename string The exported output file name. kartik\export\ExportMenu
$filterErrorOptions array The options for rendering every filter error message. yii\grid\GridView
$filterErrorSummaryOptions array The options for rendering the filter error summary. yii\grid\GridView
$filterModel yii\base\Model|null The model that keeps the user-entered filter data. yii\grid\GridView
$filterOnFocusOut boolean Whatever to apply filters on losing focus. yii\grid\GridView
$filterPosition string Whether the filters should be displayed in the grid view. yii\grid\GridView
$filterRowOptions array The HTML attributes for the filter row element. yii\grid\GridView
$filterSelector string Additional jQuery selector for selecting filter input fields yii\grid\GridView
$filterUrl string|array|null The URL for returning the filtering result. yii\grid\GridView
$floatFooter boolean Whether the grid will have a floating table footer. kartik\grid\GridViewTrait
$floatHeader boolean Whether the grid will have a floating table header. kartik\grid\GridViewTrait
$floatHeaderOptions kartik\grid\GridViewTrait
$floatOverflowContainer kartik\grid\GridViewTrait
$floatPageSummary boolean Whether the grid table will have a floating page summary at the bottom or top depending on pageSummaryPosition. kartik\grid\GridViewTrait
$folder string The folder to save the exported file. kartik\export\ExportMenu
$fontAwesome boolean Whether to use font awesome icons for rendering the icons as defined in $exportConfig. kartik\export\ExportMenu
$footerContainer array The HTML options for the table tfoot container. kartik\grid\GridViewTrait
$footerRowOptions array The HTML attributes for the table footer row. yii\grid\GridView
$formatter array|yii\i18n\Formatter|null The formatter used to format model attribute values into displayable texts. yii\grid\GridView
$groupedRowStyle array The PhpSpreadsheet style configuration for a grouped grid row kartik\export\ExportMenu
$hashExportConfig Whether to hash export config and prevent data tampering of the export config when transmitting this between client and server during grid data export. Defaults to true. You may set this to false if your config contains dynamic data (like current date time). However, note that when false it adds the possibility of your client data being tampered during grid export when read by server. kartik\grid\GridViewTrait
$headerContainer array The HTML options for the table thead. kartik\grid\GridViewTrait
$headerRowOptions array The HTML attributes for the table header row. yii\grid\GridView
$headerStyleOptions array The output style configuration options for the header row. kartik\export\ExportMenu
$hiddenColumns array The column indexes for export that will be hidden for selection in the column selector, but will still be displayed in export output. kartik\export\ExportMenu
$hideResizeMobile boolean Whether to hide resizable columns for smaller screen sizes (< 768px). kartik\grid\GridViewTrait
$hover boolean Whether the grid will highlight row on hover. kartik\grid\GridViewTrait
$i18n array The the internalization configuration for this widget. kartik\base\TranslationTrait
$id string|null ID of the widget. Note that the type of this property differs in getter and setter. See getId() and setId() for details. yii\base\Widget
$initProvider boolean Whether to initialize data provider and clear models before rendering. kartik\export\ExportMenu
$itemLabelAccusative string The default label shown for each record in the grid (accusative case). kartik\grid\GridViewTrait
$itemLabelFew string The default label shown for each record in the grid (plural). kartik\grid\GridViewTrait
$itemLabelMany string The default label shown for each record in the grid (plural). kartik\grid\GridViewTrait
$itemLabelPlural string The default label shown for each record in the grid (plural). kartik\grid\GridViewTrait
$itemLabelSingle string The default label shown for each record in the grid (singular). kartik\grid\GridViewTrait
$krajeeDialogSettings array Configuration settings for the Krajee dialog widget that will be used to render alerts and confirmation dialog prompts kartik\export\ExportMenu
$layout string The layout that determines how different sections of the list view should be organized. kartik\grid\GridViewTrait
$linkFileName string The name of the file to be appended to $linkPath to generate the complete link. kartik\export\ExportMenu
$linkPath string The web accessible path for the saved file location. kartik\export\ExportMenu
$messages \kartik\export\array, The configuration of various messages that will be displayed at runtime: - allowPopups: string, the message to be shown to disable browser popups for download. kartik\export\ExportMenu
$moduleId string The module identifier if this widget is part of a module. kartik\grid\GridViewTrait
$noExportColumns array The column indexes for export that will not be exported at all nor will they be shown in the column selector kartik\export\ExportMenu
$onGenerateFile Closure The callback function to be executed after the output file is generated. kartik\export\ExportMenu
$onInitExcel Closure The callback function on initializing the PhpSpreadsheet library. kartik\export\ExportMenu
$onInitSheet Closure The callback function to be executed on initializing the active sheet. kartik\export\ExportMenu
$onInitWriter Closure The callback function on initializing the writer. kartik\export\ExportMenu
$onRenderDataCell Closure The callback function to be executed on rendering each body data cell content. kartik\export\ExportMenu
$onRenderFooterCell Closure The callback function to be executed on rendering the footer cell output content. kartik\export\ExportMenu
$onRenderHeaderCell Closure The callback function to be executed on rendering the header cell output content. kartik\export\ExportMenu
$onRenderSheet Closure The callback function to be executed on rendering the sheet. kartik\export\ExportMenu
$options array The HTML attributes for the container tag of the grid view. yii\grid\GridView
$pageSummaryContainer kartik\grid\GridViewTrait
$pageSummaryPosition string Location of the page summary row (whether POS_TOP or POS_BOTTOM) kartik\grid\GridViewTrait
$pageSummaryRowOptions kartik\grid\GridViewTrait
$pager array The configuration for the pager widget. yii\widgets\BaseListView
$panel array The panel settings for displaying the grid view within a bootstrap styled panel. kartik\grid\GridViewTrait
$panelAfterTemplate string The template for rendering the `{after} part in the layout templates. kartik\grid\GridViewTrait
$panelBeforeTemplate string The template for rendering the `{before} part in the layout templates. kartik\grid\GridViewTrait
$panelFooterTemplate string The template for rendering the panel footer. kartik\grid\GridViewTrait
$panelHeadingTemplate string The template for rendering the panel heading. kartik\grid\GridViewTrait
$panelPrefix string The panel CSS prefix that will be applied to the panel container for rendering the grid within a bootstrap styled panel. kartik\grid\GridViewTrait
$panelTemplate string The template for rendering the grid within a bootstrap styled panel. kartik\grid\GridViewTrait
$perfectScrollbar boolean Whether pretty perfect scrollbars using perfect scrollbar plugin is to be used. kartik\grid\GridViewTrait
$perfectScrollbarOptions array The plugin options for the perfect scrollbar plugin. kartik\grid\GridViewTrait
$persistResize boolean Whether to store resized column state using local storage persistence (supported by most modern browsers). kartik\grid\GridViewTrait
$phpSpreadsheet \PhpOffice\PhpSpreadsheet\Spreadsheet The current \PhpOffice\PhpSpreadsheet\Spreadsheet object instance kartik\export\ExportMenu
$phpSpreadsheetWorksheet \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet The current \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet object instance kartik\export\ExportMenu
$phpSpreadsheetWriter \PhpOffice\PhpSpreadsheet\Writer\BaseWriter The current \PhpOffice\PhpSpreadsheet\Writer\BaseWriter object instance kartik\export\ExportMenu
$pjax boolean Whether the grid view will be rendered within a pjax container. kartik\grid\GridViewTrait
$pjaxContainerId string The pjax container identifier inside which this menu is being rendered. kartik\export\ExportMenu
$pjaxSettings array The pjax settings for the widget. kartik\grid\GridViewTrait
$placeFooterAfterBody boolean Whether to place footer after body in DOM if $showFooter is true yii\grid\GridView
$replaceTags array Tags to replace in the rendered layout. kartik\grid\GridViewTrait
$resizableColumns boolean Whether to allow resizing of columns kartik\grid\GridViewTrait
$resizableColumnsOptions array The resizableColumns plugin options kartik\grid\GridViewTrait
$resizeStorageKey string Resizable unique storage prefix to append to the grid id. kartik\grid\GridViewTrait
$responsive boolean Whether the grid will have a responsive style. kartik\grid\GridViewTrait
$responsiveWrap boolean Whether the grid will automatically wrap to fit columns for smaller display sizes. kartik\grid\GridViewTrait
$rowOptions array|Closure The HTML attributes for the table body rows. yii\grid\GridView
$selectedColumns array The selected column indexes for export. kartik\export\ExportMenu
$sheetName string The sheet name. kartik\export\ExportMenu
$showColumnSelector boolean Whether to show a column selector to select columns for export. kartik\export\ExportMenu
$showConfirmAlert boolean Whether to show a confirmation alert dialog before download. kartik\export\ExportMenu
$showFooter boolean Whether to show the footer section of the grid table. yii\grid\GridView
$showHeader boolean Whether to show the header section of the grid table. yii\grid\GridView
$showOnEmpty boolean Whether to show the grid view if $dataProvider returns no data. yii\grid\GridView
$showPageSummary boolean Whether to show the page summary row for the table. kartik\grid\GridViewTrait
$sorter array The configuration for the sorter widget. yii\widgets\BaseListView
$sorterIcons array The configuration for sorter icons. kartik\grid\GridViewTrait
$stack yii\base\Widget[] The widgets that are currently being rendered (not ended). yii\base\Widget
$stream boolean Whether to stream output to the browser. kartik\export\ExportMenu
$stripHtml boolean Whether to strip HTML tags from each of the source column data before rendering the PHP Spreadsheet Cell. kartik\export\ExportMenu
$striped boolean Whether the grid will have a striped style. kartik\grid\GridViewTrait
$styleOptions array The output style configuration options for each data cell. kartik\export\ExportMenu
$summary string The HTML content to be displayed as the summary of the list view. yii\widgets\BaseListView
$summaryOptions array The HTML attributes for the summary of the list view. yii\widgets\BaseListView
$supplementSheets array|null New supplement sheets to be created. kartik\export\ExportMenu
$tableOptions array The HTML attributes for the grid table element. yii\grid\GridView
$target string The target for submitting the export form, which will trigger the download of the exported file. kartik\export\ExportMenu
$template \kartik\export\string, The template for rendering the content in the container. kartik\export\ExportMenu
$timeout integer Timeout for the export function (in seconds), if timeout is < 0, the default PHP timeout will be used. kartik\export\ExportMenu
$toggleData boolean Whether to enable toggling of grid data. kartik\grid\GridViewTrait
$toggleDataContainer array The HTML attributes for the toggle data button group container. kartik\grid\GridViewTrait
$toggleDataOptions array The settings for the toggle data button for the toggle data type. kartik\grid\GridViewTrait
$toolbar array|string The toolbar content configuration. kartik\grid\GridViewTrait
$toolbarContainerOptions array The HTML attributes for the toolbar container. kartik\grid\GridViewTrait
$triggerDownload boolean Flag to identify if download is triggered kartik\export\ExportMenu
$view yii\web\View The view object that can be used to render views or view files. Note that the type of this property differs in getter and setter. See getView() and setView() for details. yii\base\Widget
$viewPath string The directory containing the view files for this widget. yii\base\Widget
$visibleColumns array The columns configuration kartik\export\ExportMenu

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$_beginRow integer The table beginning row kartik\export\ExportMenu
$_bsVer integer Current bootstrap version number kartik\base\BootstrapTrait
$_columnSelectorEnabled boolean Whether the column selector is enabled kartik\export\ExportMenu
$_defaultBtnCss string Default bootstrap button CSS kartik\base\BootstrapTrait
$_defaultExportConfig array The default export configuration kartik\export\ExportMenu
$_defaultIconPrefix string Default icon CSS prefix kartik\base\BootstrapTrait
$_endCol integer The current table end column kartik\export\ExportMenu
$_endRow integer The current table end row kartik\export\ExportMenu
$_filterCache string|null The filter cache kartik\grid\GridViewTrait
$_gridClientFunc string The generated client script for the grid kartik\grid\GridViewTrait
$_groupedColumn array Columns to be grouped kartik\export\ExportMenu
$_groupedRow array Grouped row values kartik\export\ExportMenu
$_headerBeginRow integer The header beginning row kartik\export\ExportMenu
$_isBs4 boolean Flag to detect whether bootstrap 4. kartik\base\BootstrapTrait
$_isShowAll boolean Whether the current mode is showing all data kartik\grid\GridViewTrait
$_module kartik\grid\Module The grid module. kartik\grid\GridViewTrait
$_msgCat string Translation message file category name for i18n. kartik\base\TranslationTrait
$_objSpreadsheet \PhpOffice\PhpSpreadsheet\Spreadsheet Object instance kartik\export\ExportMenu
$_objWorksheet \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet Object instance kartik\export\ExportMenu
$_objWriter \PhpOffice\PhpSpreadsheet\Writer\BaseWriter Object instance kartik\export\ExportMenu
$_provider yii\data\BaseDataProvider The modified data provider for usage with export. kartik\export\ExportMenu
$_toggleButtonId string HTML attribute identifier for the toggle button kartik\grid\GridViewTrait
$_toggleDataKey string Key to identify showing all data kartik\grid\GridViewTrait
$_toggleOptionsVar string The JS variable to store the toggle options kartik\grid\GridViewTrait
$_toggleScript string Generated plugin script for the toggle button kartik\grid\GridViewTrait
$_visibleColumns array The visble columns for export kartik\export\ExportMenu

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__call() Calls the named method which is not a class method. yii\base\Component
__clone() This method is called after the object is created by cloning an existing one. yii\base\Component
__construct() Constructor. yii\base\BaseObject
__get() Returns the value of a component property. yii\base\Component
__isset() Checks if a property is set, i.e. defined and not null. yii\base\Component
__set() Sets the value of a component property. yii\base\Component
__unset() Sets a component property to be null. yii\base\Component
addCssClass() Adds bootstrap CSS class to options by parsing the bootstrap version for the specified Bootstrap CSS type. kartik\base\BootstrapTrait
afterRun() This method is invoked right after a widget is executed. yii\base\Widget
attachBehavior() Attaches a behavior to this component. yii\base\Component
attachBehaviors() Attaches a list of behaviors to the component. yii\base\Component
beforeRun() This method is invoked right before the widget is executed. yii\base\Widget
begin() Begins a widget. yii\base\Widget
behaviors() Returns a list of behaviors that this component should behave as. yii\base\Component
canGetProperty() Returns a value indicating whether a property can be read. yii\base\Component
canSetProperty() Returns a value indicating whether a property can be set. yii\base\Component
className() Returns the fully qualified name of this class. yii\base\BaseObject
columnName() Returns an excel column name. kartik\export\ExportMenu
createSupplementSheets() Create supplement sheets, usually from dropDownList used by gridView. Needed for using dataValidation. kartik\export\ExportMenu
destroyPhpSpreadsheet() Destroys PhpSpreadsheet Object Instance kartik\export\ExportMenu
detachBehavior() Detaches a behavior from the component. yii\base\Component
detachBehaviors() Detaches all behaviors from the component. yii\base\Component
end() Ends a widget. yii\base\Widget
ensureBehaviors() Makes sure that the behaviors declared in behaviors() are attached to this component. yii\base\Component
generateAfterContent() Generates the after content at the bottom of the exported sheet kartik\export\ExportMenu
generateBeforeContent() Generates the before content at the top of the exported sheet kartik\export\ExportMenu
generateBody() Generates the output data body content. kartik\export\ExportMenu
generateFooter() Generates the output footer row after a specific row number kartik\export\ExportMenu
generateHeader() Generates the output data header content. kartik\export\ExportMenu
generateRow() Generates an output data row with the given data model and key. kartik\export\ExportMenu
getBSClass() Gets the respective Bootstrap class based on currently configured bootstrap version. kartik\base\BootstrapTrait
getBehavior() Returns the named behavior object. yii\base\Component
getBehaviors() Returns all behaviors attached to this component. yii\base\Component
getBsVer() Gets the current set bootstrap version number. kartik\base\BootstrapTrait
getColumnHeader() Gets the column header content kartik\export\ExportMenu
getCssClass() Gets bootstrap css class by parsing the bootstrap version for the specified BS CSS type. kartik\base\BootstrapTrait
getDefaultBtnCss() Gets the default button CSS kartik\base\BootstrapTrait
getDefaultIconPrefix() Gets the default icon css prefix kartik\base\BootstrapTrait
getDefaultSorterIcons() Gets default sorter icons kartik\grid\GridViewTrait
getDropdownClass() Gets the respective bootstrap dropdown class name based on currently configured bootstrap version. kartik\base\BootstrapTrait
getExportType() Gets the currently selected export type kartik\export\ExportMenu
getId() Returns the ID of the widget. yii\base\Widget
getPhpSpreadsheet() Gets the PhpSpreadsheet object kartik\export\ExportMenu
getPhpSpreadsheetWorksheet() Gets the PhpSpreadsheet sheet object kartik\export\ExportMenu
getPhpSpreadsheetWriter() Gets the PhpSpreadsheet writer object kartik\export\ExportMenu
getPjaxContainerId() Get pjax container identifier kartik\grid\GridViewTrait
getView() Returns the view object that can be used to render views or view files. yii\base\Widget
getViewPath() Returns the directory containing the view files for this widget. yii\base\Widget
getVisibleColumns() Gets the visible columns for export kartik\export\ExportMenu
hasEventHandlers() Returns a value indicating whether there is any handler attached to the named event. yii\base\Component
hasMethod() Returns a value indicating whether a method is defined. yii\base\Component
hasProperty() Returns a value indicating whether a property is defined for this component. yii\base\Component
init() Initializes the grid view. kartik\export\ExportMenu
initExport() Initializes export settings kartik\export\ExportMenu
initI18N() Yii i18n messages configuration for generating translations kartik\base\TranslationTrait
initPhpSpreadsheet() Initializes PhpSpreadsheet Object Instance kartik\export\ExportMenu
initPhpSpreadsheetWorksheet() Initializes PhpSpreadsheet Worksheet Instance kartik\export\ExportMenu
initPhpSpreadsheetWriter() Initializes PhpSpreadsheet Writer Object Instance kartik\export\ExportMenu
initPjaxContainerId() Initializes pjax container identifier kartik\grid\GridViewTrait
isBs() Validate Bootstrap version kartik\base\BootstrapTrait
isBs4() Validate if Bootstrap 4.x version. kartik\base\BootstrapTrait
off() Detaches an existing event handler from this component. yii\base\Component
on() Attaches an event handler to an event. yii\base\Component
parseKey() Parses the key and returns parsed key value as string based on the data type kartik\grid\GridViewTrait
removeCssClass() Removes bootstrap CSS class from options by parsing the bootstrap version for the specified Bootstrap CSS type. kartik\base\BootstrapTrait
render() Renders a view. yii\base\Widget
renderCaption() Renders the caption element. yii\grid\GridView
renderColumnGroup() Renders the column group HTML. yii\grid\GridView
renderColumnSelector() Renders the columns selector kartik\export\ExportMenu
renderEmpty() Renders the HTML content indicating that the list view has no data. yii\widgets\BaseListView
renderErrors() Renders validator errors of filter model. yii\grid\GridView
renderExport() Renders the export menu. kartik\grid\GridViewTrait
renderExportMenu() Renders the export menu kartik\export\ExportMenu
renderFile() Renders a view file. yii\base\Widget
renderFilters() Renders the filter. yii\grid\GridView
renderItems() Renders the data models for the grid view. yii\grid\GridView
renderPageSummary() Renders the table page summary. kartik\grid\GridViewTrait
renderPager() Renders the pager. yii\widgets\BaseListView
renderSection() Renders a section of the specified name. yii\grid\GridView
renderSorter() Renders the sorter. yii\widgets\BaseListView
renderSummary() Renders the summary text. kartik\grid\GridView
renderTableBody() Renders the table body. yii\grid\GridView
renderTableFooter() Renders the table footer. yii\grid\GridView
renderTableHeader() Renders the table header. yii\grid\GridView
renderTableRow() Renders a table row with the given data model and key. kartik\grid\GridViewTrait
renderToggleData() Renders the toggle data button. kartik\grid\GridViewTrait
run() Runs the widget. kartik\export\ExportMenu
sanitize() Sanitizes file name kartik\export\ExportMenu
setDataValidation() Excel Data Validation (dropDownList in excel). Requires supplementSheets. kartik\export\ExportMenu
setId() Sets the ID of the widget. yii\base\Widget
setPhpSpreadsheet() Sets the PhpSpreadsheet object kartik\export\ExportMenu
setPhpSpreadsheetWorksheet() Sets the PhpSpreadsheet sheet object kartik\export\ExportMenu
setPhpSpreadsheetWriter() Sets the PhpSpreadsheet writer object kartik\export\ExportMenu
setView() Sets the view object to be used by this widget. yii\base\Widget
setVisibleColumns() Sets visible columns for export kartik\export\ExportMenu
slash() Appends slash to path if it does not exist kartik\export\ExportMenu
trigger() Triggers an event. yii\base\Component
widget() Creates a widget instance and runs it. yii\base\Widget

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
autoFormat() Autoformats a cell by auto detecting the grid column alignment and format kartik\export\ExportMenu
beginPjax() Begins the pjax widget rendering kartik\grid\GridViewTrait
checkGroupedRow() Validates a grouped row kartik\export\ExportMenu
cleanup() Cleans up the export file and current object instance kartik\export\ExportMenu
clearOutputBuffers() Clear output buffers kartik\export\ExportMenu
configureBsVersion() Configures the bootstrap version settings kartik\base\BootstrapTrait
createDataColumn() Creates a yii\grid\DataColumn object based on a string in the format of "attribute:format:label". yii\grid\GridView
endPjax() Completes the pjax widget rendering kartik\grid\GridViewTrait
findGroupedColumn() Search all groupable columns kartik\export\ExportMenu
genToggleDataScript() Generate toggle data client validation script. kartik\grid\GridViewTrait
generateBox() Generates the box kartik\export\ExportMenu
generateGroupedRow() Generate a grouped row kartik\export\ExportMenu
generateRows() Generate HTML markup for additional table rows for header and/or footer. kartik\grid\GridViewTrait
getAttributeLabel() Generates the attribute label kartik\export\ExportMenu
getBsExtBasename() The yii2-bootstrap extension base name. kartik\base\BootstrapTrait
getClientOptions() Returns the options for the grid view JS widget. yii\grid\GridView
getColumnLabel() Fetches the column label kartik\export\ExportMenu
getPageSummaryRow() Get the page summary row markup kartik\grid\GridViewTrait
getSetting() Gets the setting property value for the current export format kartik\export\ExportMenu
getStyleOpts() Parses and returns the style options for contentBefore or contentAfter kartik\export\ExportMenu
guessColumns() This function tries to guess the columns to show from the given data if $columns are not explicitly specified. yii\grid\GridView
initBootstrapStyle() Initialize bootstrap specific styling. kartik\grid\GridViewTrait
initBsVersion() Initializes bootstrap versions for the widgets and asset bundles. kartik\base\BootstrapTrait
initColumnSelector() Initialize column selector list kartik\export\ExportMenu
initColumns() Creates column objects and initializes them. yii\grid\GridView
initCss() Sets a default css class within options if not set kartik\grid\GridViewTrait
initEditedRow() kartik\grid\GridViewTrait
initGridView() Initializes the Krajee GridView widget kartik\grid\GridViewTrait
initLayout() Initialize the grid layout. kartik\grid\GridViewTrait
initModule() Initialize the module based on module identifier kartik\grid\GridViewTrait
initPanel() Initializes and sets the grid panel layout based on the template and $panel settings. kartik\grid\GridViewTrait
initSelectedColumns() Initialize columns selected for export kartik\export\ExportMenu
initSettings() Initialize export menu settings kartik\export\ExportMenu
initToggleData() Initialize toggle data button options. kartik\grid\GridViewTrait
isSameVersion() Compares two versions and checks if they are of the same major BS version. kartik\base\BootstrapTrait
parseExportConfig() Parses export configuration and returns the merged defaults. kartik\grid\GridViewTrait
parseVer() Parses and returns the major BS version kartik\base\BootstrapTrait
prepareGridView() Prepares the Krajee GridView widget for run kartik\grid\GridViewTrait
raiseEvent() Raises a callable event kartik\export\ExportMenu
registerAssets() Registers client assets needed for Export Menu widget kartik\export\ExportMenu
renderTablePart() Renders the table header or footer part kartik\grid\GridViewTrait
renderToolbar() Generates the toolbar. kartik\grid\GridViewTrait
renderToolbarContainer() Generates the toolbar container with the toolbar kartik\grid\GridViewTrait
replaceLayoutTokens() Replace layout tokens kartik\grid\GridViewTrait
setDefaultExportConfig() Sets the default export configuration kartik\export\ExportMenu
setDefaultStyles() Sets default styles kartik\export\ExportMenu
setHttpHeaders() Set HTTP headers for download kartik\export\ExportMenu
setOutCellValue() Parses format and sets the value of a PHP Spreadsheet Cell kartik\export\ExportMenu
setPagerOptionClass() Adds CSS class to the pager parameter kartik\grid\GridViewTrait

Events

Hide inherited events

EventTypeDescriptionDefined By
EVENT_AFTER_RUN yii\base\WidgetEvent An event raised right after executing a widget. (available since version 2.0.11) yii\base\Widget
EVENT_BEFORE_RUN yii\base\WidgetEvent An event raised right before executing a widget. (available since version 2.0.11) yii\base\Widget
EVENT_INIT yii\base\Event An event that is triggered when the widget is initialized via init(). (available since version 2.0.11) yii\base\Widget

Constants

Hide inherited constants

ConstantValueDescriptionDefined By
ENCODING_UTF8 'utf-8' kartik\export\ExportMenu
FILTER_POS_BODY 'body' yii\grid\GridView
FILTER_POS_HEADER 'header' yii\grid\GridView
FORMAT_CSV 'Csv' kartik\export\ExportMenu
FORMAT_EXCEL 'Xls' kartik\export\ExportMenu
FORMAT_EXCEL_X 'Xlsx' kartik\export\ExportMenu
FORMAT_HTML 'Html' kartik\export\ExportMenu
FORMAT_PDF 'Pdf' kartik\export\ExportMenu
FORMAT_TEXT 'Txt' kartik\export\ExportMenu
TARGET_BLANK '_blank' kartik\export\ExportMenu
TARGET_IFRAME '_iframe' kartik\export\ExportMenu
TARGET_POPUP '_popup' kartik\export\ExportMenu
TARGET_SELF '_self' kartik\export\ExportMenu

Property Details

$_beginRow protected property

The table beginning row

protected integer $_beginRow 1
$_columnSelectorEnabled protected property

Whether the column selector is enabled

$_defaultExportConfig protected property

The default export configuration

$_endCol protected property

The current table end column

protected integer $_endCol 1
$_endRow protected property

The current table end row

protected integer $_endRow 0
$_groupedColumn protected property

Columns to be grouped

protected array $_groupedColumn = []
$_groupedRow protected property

Grouped row values

protected array $_groupedRow null
$_headerBeginRow protected property

The header beginning row

protected integer $_headerBeginRow 1
$_objSpreadsheet protected property

Object instance

protected \PhpOffice\PhpSpreadsheet\Spreadsheet $_objSpreadsheet null
$_objWorksheet protected property

Object instance

protected \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $_objWorksheet null
$_objWriter protected property

Object instance

protected \PhpOffice\PhpSpreadsheet\Writer\BaseWriter $_objWriter null
$_provider protected property

The modified data provider for usage with export.

$_visibleColumns protected property

The visble columns for export

protected array $_visibleColumns null
$afterSaveView public property

The view file to show details of exported file link. This property will be validated only when $stream is false. You can set this to false to not display any file link details for view. This defaults to the _view PHP file in the views folder of the extension.

$asDropdown public property

Whether to render the export menu as bootstrap button dropdown widget. Defaults to true. If set to false, this will generate a simple HTML list of links.

public boolean $asDropdown true
$autoWidth public property

Whether to auto-size the excel output column widths. Defaults to true.

public boolean $autoWidth true
$batchSize public property

Fetch models from the dataprovider using batches of this size. Set this to 0 (the default) to disable. If $dataProvider does not have a pagination object, this parameter is ignored. Setting this property helps reduce memory overflow issues by allowing parsing of models in batches, rather than fetching all models in one go.

public integer $batchSize 0
$boxStyleOptions public property

The output style configuration options for the entire spreadsheet box range. It must be the style configuration array as required by \PhpOffice\PhpSpreadsheet\Spreadsheet.

public array $boxStyleOptions = []
$clearBuffers public property

Whether to clear all previous / parent buffers. Defaults to false.

public boolean $clearBuffers false
$colSelFlagParam public property

The column selector flag parameter for export form

public string $colSelFlagParam 'column_selector_enabled'
$columnBatchToggleSettings public property

The settings for the toggle all checkbox to check / uncheck the columns as a batch. Should be setup as an associative array which can have the following keys:

  • show: boolean, whether the batch toggle checkbox is to be shown. Defaults to true.
  • label: string, the label to be displayed for toggle all. Defaults to Select Columns.
  • options: array, the HTML attributes for the toggle label text. Defaults to ['class'=>'kv-toggle-all']
$columnSelector public property

The configuration of the column names in the column selector. Note: column names will be generated automatically by default. Any setting in this property will override the auto-generated column names. This list should be setup as $key => $value where:

  • $key: integer, is the zero based index of the column as set in $columns.
  • $value: string, is the column name/label you wish to display in the column selector.
public array $columnSelector = []
$columnSelectorMenuOptions public property

The HTML attributes for the column selector menu list.

$columnSelectorOptions public property

The HTML attributes for the column selector dropdown button. The following special options are recognized:

  • label: string, defaults to empty string.
  • icon: string, defaults to <i class="glyphicon glyphicon-list"></i> for BS3 and <i class="fas fa-list"></i> for BS4
  • title: string, defaults to Select columns for export.
$container public property

HTML attributes for the container to wrap the widget. Defaults to: ['class'=>'btn-group', 'role'=>'group']

public \kartik\export\array, $container = [
    'class' => 'btn-group''role' => 'group'
]
$contentAfter public property

An array of rows to append after the footer row. Each array should be set with the following settings:

  • value: string, the value of the merged row
  • cellFormat: string|null, the explicit cell format to apply (should be one of the PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_ constants)
  • styleOptions: array, array of configuration options to set the style. See $styleOptions on how to configure.
public array $contentAfter = []
$contentBefore public property

An array of rows to prepend in front of the grid used to create things like a title. Each array should be set with the following settings:

  • value: string, the value of the merged row
  • cellFormat: string|null, the explicit cell format to apply (should be one of the PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_ constants)
  • styleOptions: array, array of configuration options to set the style. See $styleOptions on how to configure.
public array $contentBefore = []
$dataValidation public property

Data for creating excel data validation. An example setting: 'dataValidation' => ['sheetName1' => ['cellPosition' => count($array)], 'sheetName2' => []], If set to empty or null will be ignored.

public array|null $dataValidation null
$deleteAfterSave public property

Whether to delete file after saving file to $folder and when $stream is false. This property will be validated only when $stream is false.

public boolean $deleteAfterSave false
$disabledColumns public property

The column indexes for export that will be disabled for selection in the column selector.

public array $disabledColumns = []
$docProperties public property

The \PhpOffice\PhpSpreadsheet\Spreadsheet document properties

public array $docProperties = []
$dropdownOptions public property

The HTML attributes for the export button menu. Applicable only if $asDropdown is set to true. The following special options are available:

  • label: string, defaults to empty string
  • icon: string, defaults to <i class="glyphicon glyphicon-export"></i> for BS3 and <i class="fas fa-external-link-alt"></i> for BS4
  • title: string, defaults to Export data in selected format.
  • menuOptions: array, the HTML attributes for the dropdown menu.
  • itemsBefore: array, any additional items that will be merged/prepended before with the export dropdown list. This should be similar to the items property as supported by ButtonDropdown widget. Note the page export items will be automatically generated based on settings in the $exportConfig property.
  • itemsAfter: array, any additional items that will be merged/appended after with the export dropdown list. This should be similar to the items property as supported by ButtonDropdown widget. Note the page export items will be automatically generated based on settings in the exportConfig property.
public array $dropdownOptions = []
$dynagrid public property

Enable dynagrid for column selection. If set to true the inbuilt export menu column selector functionality will be disabled and not rendered and column settings for dynagrid will be used as per settings configured in $dynagridOptions.

public boolean $dynagrid false
$dynagridOptions public property

Dynagrid widget options. Applicable only if $dynagrid is set to true.

public array $dynagridOptions = [
    'options' => ['id' => 'dynagrid-export-menu']
]
$enableAutoFormat public property

Enable or disable cell formatting by auto detecting the grid column alignment and format. If set to false the format will not be applied but improve performance configured in $dynagridOptions.

public boolean $enableAutoFormat true
$enableFormatter public property

Whether to enable the yii gridview formatter component. Defaults to true. If set to false, this will render content as raw format.

public boolean $enableFormatter true
$encoding public property

Encoding for the downloaded file header. Defaults to ENCODING_UTF8.

public string $encoding self::ENCODING_UTF8
$exportColsParam public property

The export columns input parameter for export form

public string $exportColsParam 'export_columns'
$exportColumnsView public property

The view file for rendering the columns selection

public string $exportColumnsView null
$exportConfig public property

The export configuration. The array keys must be the one of the format constants (CSV, HTML, TEXT, EXCEL, PDF) and the array value is a configuration array consisting of these settings:

  • label: string, the label for the export format menu item displayed
  • icon: string, the glyphicon or font-awesome name suffix to be displayed before the export menu item label. If set to an empty string_, this will not be displayed.
  • iconOptions: array, HTML attributes for export menu icon.
  • linkOptions: array, HTML attributes for each export item link.
  • filename: string, the base file name for the generated file. Defaults to 'grid-export'. This will be used to generate a default file name for downloading.
  • extension: string, the extension for the file name
  • alertMsg: string, the message prompt to show before saving. If this is empty or not set it will not be displayed.
  • mime: string, the mime type (for the file format) to be set before downloading.
  • writer: string, the PhpSpreadsheet writer type
  • options: array, HTML attributes for the export menu item.
public array $exportConfig = []
$exportFormHiddenInputs public property

The configuration of additional hidden inputs that will be rendered with the export form. This will be set as an array of hidden input $name => $setting pairs where:

  • $name: string, is the hidden input name attribute.
  • $setting: array, containing the following settings:
    • value: string, the value of the hidden input. Defaults to NULL.
    • options: array, the HTML attributes for the hidden input. Defaults to an empty array [].

An example of how you can configure this property is shown below:

[
   'inputName1' => ['value' => 'inputValue1'],
   'inputName2' => ['value' => 'inputValue2', 'options' => ['id' => 'inputId2']],
]
$exportFormOptions public property

The HTML attributes for the export form.

$exportFormView public property

The view file for rendering the export form. DEPRECATED since v1.3.5 (not parsed or used anymore).

public string $exportFormView '_form'
$exportRequestParam public property

The request parameter ($_GET or $_POST) that will be submitted during export. If not set this will be auto generated. This should be unique for each export menu widget (for multiple export menu widgets on same page).

$exportType public property

The data output format type. Defaults to ExportMenu::FORMAT_EXCEL_X.

public string $exportType self::FORMAT_EXCEL_X
$exportTypeParam public property

The export type input parameter for export form

public string $exportTypeParam 'export_type'
$filename public property

The exported output file name. Defaults to 'grid-export';

public string $filename null
$folder public property

The folder to save the exported file. Defaults to '@app/runtime/export/'. If the specified folder does not exist, the extension will attempt to create it - else an exception will be thrown.

public string $folder '@app/runtime/export'
$fontAwesome public property

Whether to use font awesome icons for rendering the icons as defined in $exportConfig. If set to true, you must load the FontAwesome CSS separately in your application.

public boolean $fontAwesome false
$groupedRowStyle public property

The PhpSpreadsheet style configuration for a grouped grid row

public array $groupedRowStyle = [
    'font' => ['bold' => false'color' => ['argb' => \PhpOffice\PhpSpreadsheet\Style\Color::COLOR_DARKBLUE]], 'fill' => ['type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID'color' => ['argb' => \PhpOffice\PhpSpreadsheet\Style\Color::COLOR_WHITE]]]
$headerStyleOptions public property

The output style configuration options for the header row. It must be the style configuration array as required by \PhpOffice\PhpSpreadsheet\Spreadsheet.

$hiddenColumns public property

The column indexes for export that will be hidden for selection in the column selector, but will still be displayed in export output.

public array $hiddenColumns = []
$initProvider public property

Whether to initialize data provider and clear models before rendering. Defaults to false.

public boolean $initProvider false
$krajeeDialogSettings public property

Configuration settings for the Krajee dialog widget that will be used to render alerts and confirmation dialog prompts

See also http://demos.krajee.com/dialog.

$linkFileName public property

The name of the file to be appended to $linkPath to generate the complete link. If not set, this will default to the $filename.

public string $linkFileName null
$linkPath public property

The web accessible path for the saved file location. This property will be parsed only if $stream is false. Note the $afterSaveView property that will render the displayed file link.

public string $linkPath '/runtime/export'
$messages public property

The configuration of various messages that will be displayed at runtime:

  • allowPopups: string, the message to be shown to disable browser popups for download. Defaults to Disable any popup blockers in your browser to ensure proper download..
  • confirmDownload: string, the message to be shown for confirming to proceed with the download. Defaults to Ok to proceed?.
  • downloadProgress: string, the message to be shown in a popup dialog when download request is executed. Defaults to Generating file. Please wait....
  • downloadComplete: string, the message to be shown in a popup dialog when download request is completed. Defaults to All done! Click anywhere here to close this window, once you have downloaded the file..
public \kartik\export\array, $messages = []
$noExportColumns public property

The column indexes for export that will not be exported at all nor will they be shown in the column selector

public array $noExportColumns = []
$onGenerateFile public property

The callback function to be executed after the output file is generated. This function must return a boolean status of true or false. A false status will abort the post file generation activities. The anonymous function should have the following signature: `php function ($fileExt, $widget) ` where:

  • $fileExt: string, is the generated file extension.
  • $widget: ExportMenu, the current ExportMenu object instance
public Closure $onGenerateFile null
$onInitExcel public property

The callback function on initializing the PhpSpreadsheet library. The anonymous function should have the following signature: `php function ($spreadsheet, $widget) ` where:

  • $spreadsheet: \PhpOffice\PhpSpreadsheet\Spreadsheet, the Spreadsheet object instance
  • $widget: ExportMenu, the current ExportMenu object instance
public Closure $onInitExcel null
$onInitSheet public property

The callback function to be executed on initializing the active sheet. The anonymous function should have the following signature: `php function ($sheet, $widget) ` where:

  • $sheet: \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet, the Worksheet object instance
  • $widget: ExportMenu, the current ExportMenu object instance
public Closure $onInitSheet null
$onInitWriter public property

The callback function on initializing the writer. The anonymous function should have the following signature: `php function ($writer, $widget) ` where:

  • $writer: \PhpOffice\PhpSpreadsheet\Writer\BaseWriter, the BaseWriter object instance
  • $widget: ExportMenu, the current ExportMenu object instance
public Closure $onInitWriter null
$onRenderDataCell public property

The callback function to be executed on rendering each body data cell content. The anonymous function should have the following signature: `php function ($cell, $content, $model, $key, $index, $widget) ` where:

  • $cell: \PhpOffice\PhpSpreadsheet\Cell\Cell, the current Spreadsheet cell being rendered
  • $content: string, the data cell content being rendered
  • $model: Model, the data model to be rendered
  • $key: mixed, the key associated with the data model
  • $index: integer, the zero-based index of the data model among the model array returned by $dataProvider.
  • $widget: ExportMenu, the current ExportMenu object instance
public Closure $onRenderDataCell null
$onRenderFooterCell public property

The callback function to be executed on rendering the footer cell output content. The anonymous function should have the following signature: `php function ($cell, $content, $widget) ` where:

  • $sheet: \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet, the Worksheet object instance
  • $content: string, the footer cell content being rendered
  • $widget: ExportMenu, the current ExportMenu object instance
$onRenderHeaderCell public property

The callback function to be executed on rendering the header cell output content. The anonymous function should have the following signature: `php function ($cell, $content, $widget) ` where:

  • $cell: \PhpOffice\PhpSpreadsheet\Cell\Cell, is the current Spreadsheet cell being rendered
  • $content: string, is the header cell content being rendered
  • $widget: ExportMenu, the current ExportMenu object instance
$onRenderSheet public property

The callback function to be executed on rendering the sheet. The anonymous function should have the following signature: `php function ($sheet, $widget) ` where:

  • $sheet: \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet, the Worksheet object instance
  • $widget: ExportMenu, the current ExportMenu object instance
public Closure $onRenderSheet null
$phpSpreadsheet public property

The current \PhpOffice\PhpSpreadsheet\Spreadsheet object instance

public \PhpOffice\PhpSpreadsheet\Spreadsheet getPhpSpreadsheet ( )
public void setPhpSpreadsheet ( \PhpOffice\PhpSpreadsheet\Spreadsheet $obj )
$phpSpreadsheetWorksheet public property

The current \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet object instance

public \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet getPhpSpreadsheetWorksheet ( )
public void setPhpSpreadsheetWorksheet ( $obj )
$phpSpreadsheetWriter public property

The current \PhpOffice\PhpSpreadsheet\Writer\BaseWriter object instance

public \PhpOffice\PhpSpreadsheet\Writer\BaseWriter getPhpSpreadsheetWriter ( )
public void setPhpSpreadsheetWriter ( $obj )
$pjaxContainerId public property

The pjax container identifier inside which this menu is being rendered. If set the jQuery export menu plugin will get auto initialized on pjax request completion.

public string $pjaxContainerId null
$selectedColumns public property

The selected column indexes for export. If not set this will default to all columns.

public array $selectedColumns null
$sheetName public property

The sheet name. Defaults to 'Worksheet'.

public string $sheetName 'Worksheet'
$showColumnSelector public property

Whether to show a column selector to select columns for export. Defaults to true. This is applicable only if $asDropdown is set to true. Else this property is ignored.

$showConfirmAlert public property

Whether to show a confirmation alert dialog before download. This confirmation dialog will notify user about the type of exported file for download and to disable popup blockers. Defaults to true.

public boolean $showConfirmAlert true
$stream public property

Whether to stream output to the browser.

public boolean $stream true
$stripHtml public property

Whether to strip HTML tags from each of the source column data before rendering the PHP Spreadsheet Cell.

public boolean $stripHtml true
$styleOptions public property

The output style configuration options for each data cell. It must be the style configuration array as required by \PhpOffice\PhpSpreadsheet\Spreadsheet.

public array $styleOptions = []
$supplementSheets public property

New supplement sheets to be created. Required for data validation in excel. An example setting: 'supplementSheets' => ['city' => $citiesKeyValueArray, 'state' => $stateKeyValueArray], If set to empty or null will be ignored.

$target public property

The target for submitting the export form, which will trigger the download of the exported file. Must be one of the TARGET_ constants. Defaults to TARGET_SELF. Note if you set $stream to false, then this will be always overridden to TARGET_SELF.

public string $target self::TARGET_SELF
$template public property

The template for rendering the content in the container. This will be parsed only if asDropdown is true. The following tokens will be replaced:

  • {columns}: will be replaced with the column selector dropdown
  • {menu}: will be replaced with export menu dropdown
public \kartik\export\string, $template "{columns}\n{menu}"
$timeout public property

Timeout for the export function (in seconds), if timeout is < 0, the default PHP timeout will be used.

public integer $timeout = -1
$triggerDownload public property

Flag to identify if download is triggered

public boolean $triggerDownload false
$visibleColumns public read-only property

The columns configuration

Method Details

autoFormat() protected method

Autoformats a cell by auto detecting the grid column alignment and format

protected void autoFormat ( $model, $key, $index, $column, $cell )
$model mixed

The data model to be rendered

$key mixed

The key associated with the data model

$index integer

The zero-based index of the data model among the model array returned by $dataProvider.

$column yii\grid\Column
$cell \PhpOffice\PhpSpreadsheet\Cell\Cell
throws \PhpOffice\PhpSpreadsheet\Exception|\Exception
checkGroupedRow() protected method

Validates a grouped row

protected void checkGroupedRow ( $model, $nextModel, $key, $index )
$model yii\base\Model|array

The data model

$nextModel yii\base\Model|array

The next data model

$key integer

The key associated with the data model

$index integer

The zero-based index of the data model among the model array returned by $dataProvider.

throws \PhpOffice\PhpSpreadsheet\Exception
cleanup() protected method

Cleans up the export file and current object instance

protected void cleanup ( $file, $config )
$file string

The file exported

$config array

The export configuration

clearOutputBuffers() protected method

Clear output buffers

protected void clearOutputBuffers ( )
columnName() public static method

Returns an excel column name.

public static string columnName ( $index )
$index integer

The column index number

createSupplementSheets() public method

Create supplement sheets, usually from dropDownList used by gridView. Needed for using dataValidation.

public void createSupplementSheets ( )
throws \PhpOffice\PhpSpreadsheet\Exception
destroyPhpSpreadsheet() public method

Destroys PhpSpreadsheet Object Instance

public void destroyPhpSpreadsheet ( )
findGroupedColumn() protected method

Search all groupable columns

protected void findGroupedColumn ( )
generateAfterContent() public method

Generates the after content at the bottom of the exported sheet

public void generateAfterContent ( $row )
$row integer

The row number after which the content is to be generated

throws \PhpOffice\PhpSpreadsheet\Exception
generateBeforeContent() public method

Generates the before content at the top of the exported sheet

public void generateBeforeContent ( )
throws \PhpOffice\PhpSpreadsheet\Exception
generateBody() public method

Generates the output data body content.

public integer generateBody ( )
return integer

The number of output rows.

throws \PhpOffice\PhpSpreadsheet\Exception
generateBox() protected method

Generates the box

protected void generateBox ( )
generateFooter() public method

Generates the output footer row after a specific row number

public integer generateFooter ( )
return integer

The row number after which the footer is to be generated

throws \PhpOffice\PhpSpreadsheet\Exception
generateGroupedRow() protected method

Generate a grouped row

protected void generateGroupedRow ( $groupFooter, $groupedCol )
$groupFooter array

Footer row

$groupedCol integer

The zero-based index of grouped column

throws \PhpOffice\PhpSpreadsheet\Exception
generateHeader() public method

Generates the output data header content.

public void generateHeader ( )
throws \PhpOffice\PhpSpreadsheet\Exception
generateRow() public method

Generates an output data row with the given data model and key.

public void generateRow ( $model, $key, $index )
$model mixed

The data model to be rendered

$key mixed

The key associated with the data model

$index integer

The zero-based index of the data model among the model array returned by $dataProvider.

throws \PhpOffice\PhpSpreadsheet\Exception
getAttributeLabel() protected method

Generates the attribute label

protected string getAttributeLabel ( $attribute )
$attribute string
getColumnHeader() public method

Gets the column header content

public string getColumnHeader ( $col )
$col yii\grid\DataColumn
getColumnLabel() protected method

Fetches the column label

protected string getColumnLabel ( $key, $column )
$key integer
$column yii\grid\Column
getExportType() public method

Gets the currently selected export type

public string getExportType ( )
getPhpSpreadsheet() public method

Gets the PhpSpreadsheet object

public \PhpOffice\PhpSpreadsheet\Spreadsheet getPhpSpreadsheet ( )
return \PhpOffice\PhpSpreadsheet\Spreadsheet

The current \PhpOffice\PhpSpreadsheet\Spreadsheet object instance

getPhpSpreadsheetWorksheet() public method

Gets the PhpSpreadsheet sheet object

public \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet getPhpSpreadsheetWorksheet ( )
return \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet

The current \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet object instance

getPhpSpreadsheetWriter() public method

Gets the PhpSpreadsheet writer object

public \PhpOffice\PhpSpreadsheet\Writer\BaseWriter getPhpSpreadsheetWriter ( )
return \PhpOffice\PhpSpreadsheet\Writer\BaseWriter

The current \PhpOffice\PhpSpreadsheet\Writer\BaseWriter object instance

getSetting() protected method

Gets the setting property value for the current export format

protected mixed getSetting ( $key, $default null )
$key string

The setting property key for the current export format

$default string

The default value for the property

throws Exception
getStyleOpts() protected method

Parses and returns the style options for contentBefore or contentAfter

protected array getStyleOpts ( $settings = [] )
$settings array

The settings to parse (for contentBefore or contentAfter)

throws Exception
getVisibleColumns() public method

Gets the visible columns for export

public array getVisibleColumns ( )
return array

The columns configuration

init() public method

Initializes the grid view.

This method will initialize required property values and instantiate $columns objects.

public void init ( )
initColumnSelector() protected method

Initialize column selector list

protected void initColumnSelector ( )
initExport() public method

Initializes export settings

public void initExport ( )
initPhpSpreadsheet() public method

Initializes PhpSpreadsheet Object Instance

public void initPhpSpreadsheet ( )
initPhpSpreadsheetWorksheet() public method

Initializes PhpSpreadsheet Worksheet Instance

public void initPhpSpreadsheetWorksheet ( )
initPhpSpreadsheetWriter() public method

Initializes PhpSpreadsheet Writer Object Instance

public void initPhpSpreadsheetWriter ( $type )
$type string

The writer type as set in export config

throws \PhpOffice\PhpSpreadsheet\Writer\Exception
initSelectedColumns() protected method

Initialize columns selected for export

protected void initSelectedColumns ( )
initSettings() protected method

Initialize export menu settings

protected void initSettings ( )
raiseEvent() protected method

Raises a callable event

protected mixed raiseEvent ( $event, $params )
$event string

The event name

$params array

The parameters to the callable function

registerAssets() protected method

Registers client assets needed for Export Menu widget

protected void registerAssets ( )
throws \Exception|\Throwable
renderColumnSelector() public method

Renders the columns selector

public string renderColumnSelector ( )
return string

The column selector markup

throws Exception
renderExportMenu() public method

Renders the export menu

public string renderExportMenu ( )
return string

The export menu markup

throws yii\base\InvalidConfigException
throws \Exception|\Throwable
run() public method

Runs the widget.

public void run ( )
sanitize() public static method

Sanitizes file name

public static string sanitize ( $string )
$string string
throws Exception
setDataValidation() public method

Excel Data Validation (dropDownList in excel). Requires supplementSheets.

public void setDataValidation ( $sheetName, $cell, $length )
$sheetName string
$cell integer|string
$length integer
throws \PhpOffice\PhpSpreadsheet\Exception
setDefaultExportConfig() protected method

Sets the default export configuration

protected void setDefaultExportConfig ( )
throws \yii\base\InvalidConfigException|\Exception
setDefaultStyles() protected method

Sets default styles

protected void setDefaultStyles ( $section )
$section string

The php spreadsheet section

setHttpHeaders() protected method

Set HTTP headers for download

protected void setHttpHeaders ( )
setOutCellValue() protected method

Parses format and sets the value of a PHP Spreadsheet Cell

protected \PhpOffice\PhpSpreadsheet\Cell\Cell setOutCellValue ( $sheet, $index, $value, $format null )
$sheet \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet
$index string

Coordinate of the cell, eg: 'A1'

$value mixed

Value of the cell

$format string|null

The explicit cell format to apply (should be one of the PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_ constants)

throws \PhpOffice\PhpSpreadsheet\Exception
setPhpSpreadsheet() public method

Sets the PhpSpreadsheet object

public void setPhpSpreadsheet ( \PhpOffice\PhpSpreadsheet\Spreadsheet $obj )
$obj

Spreadsheet the \PhpOffice\PhpSpreadsheet\Spreadsheet object instance

setPhpSpreadsheetWorksheet() public method

Sets the PhpSpreadsheet sheet object

public void setPhpSpreadsheetWorksheet ( $obj )
$obj

Worksheet the \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet object instance

setPhpSpreadsheetWriter() public method

Sets the PhpSpreadsheet writer object

public void setPhpSpreadsheetWriter ( $obj )
$obj

BaseWriter the \PhpOffice\PhpSpreadsheet\Writer\BaseWriter object instance

setVisibleColumns() public method

Sets visible columns for export

public void setVisibleColumns ( )
slash() public static method

Appends slash to path if it does not exist

public static string slash ( $path, $s DIRECTORY_SEPARATOR )
$path string
$s string

The path separator