Class kartik\dynagrid\DynaGrid
Inheritance | kartik\dynagrid\DynaGrid » kartik\base\Widget » yii\base\Widget » yii\base\Component » yii\base\BaseObject |
---|---|
Implements | kartik\base\BootstrapInterface, yii\base\Configurable, yii\base\ViewContextInterface |
Uses Traits | kartik\base\BootstrapTrait, kartik\base\TranslationTrait, kartik\base\WidgetTrait, kartik\dynagrid\DynaGridTrait |
Available since version | 1.0 |
Enhance GridView by allowing you to dynamically edit grid configuration. The dynagrid allows you to set your own grid theme, pagesize, and column order/display settings. The widget allows you to manage the order and visibility of columns dynamically at runtime. It also allows you to save this configuration or retrieve the saved configuration to/from session, cookie, or database.
Public Properties
Property | Type | Description | Defined By |
---|---|---|---|
$allowFilterSetting | boolean | Whether to allow display/setup of the filter in the personalize grid form | kartik\dynagrid\DynaGrid |
$allowPageSetting | boolean | Whether to allow setup of the pagination. | kartik\dynagrid\DynaGrid |
$allowSortSetting | boolean | Whether to allow display/setup of the sort in the personalize grid form | kartik\dynagrid\DynaGrid |
$allowThemeSetting | boolean | Whether to allow display/setup of the theme. | kartik\dynagrid\DynaGrid |
$autoIdPrefix | string | The prefix to the automatically generated widget IDs. | yii\base\Widget |
$baseSourcePath | string|false | Get parsed base source path based on $sourcePath setting. If $sourcePath is not set, it will return the current working directory of this widget class. | kartik\base\WidgetTrait |
$behaviors | yii\base\Behavior[] | List of behaviors attached to this component. | yii\base\Component |
$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 |
$columns | array | The grid columns configuration | kartik\dynagrid\DynaGrid |
$counter | integer | A counter used to generate $id for widgets. | yii\base\Widget |
$dbUpdateNameOnly | boolean | Whether to update only the name, when editing and saving a filter or sort. | kartik\dynagrid\DynaGrid |
$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 |
$defaultOptions | array | Default HTML attributes or other settings for widgets. | kartik\base\WidgetTrait |
$defaultPluginOptions | array | Default plugin options for the widget | kartik\base\WidgetTrait |
$deleteButtonOptions | array|boolean | The HTML attributes for the delete/trash action button. | kartik\dynagrid\DynaGrid |
$deleteConfirmation | string | The confirmation warning message before deleting a personalization configuration or setting. | kartik\dynagrid\DynaGrid |
$deleteMessage | string | The message to display after deleting the configuration and until refreshed grid is reloaded | kartik\dynagrid\DynaGrid |
$dropdownClass | string | Bootstrap dropdown class name based on currently configured bootstrap version (readonly property available via getter method getDropdownClass()) | kartik\base\BootstrapTrait |
$enableMultiSort | boolean | Whether to enable multiple sort. | kartik\dynagrid\DynaGrid |
$gridOptions | array | Widget options for \kartik\widgets\GridView that will be rendered by the DynaGrid widget | kartik\dynagrid\DynaGrid |
$hashVarLoadPosition | integer | The position where the client JS hash variables for the input widget will be loaded. | kartik\base\WidgetTrait |
$i18n | array | The the internalization configuration for this widget. | kartik\base\TranslationTrait |
$iconConfirm | string | The icon for the save button within the dynagrid configuration form. | kartik\dynagrid\DynaGrid |
$iconFilter | string | The icon that will be displayed as the label for grid filter personalization button. | kartik\dynagrid\DynaGrid |
$iconHiddenColumn | string | The icon that will be displayed for each HIDDEN column heading in the column reordering pane. | kartik\dynagrid\DynaGrid |
$iconPersonalize | string | The icon that will be displayed on the dynagrid personalize button as well as the personalize modal dialog header. | kartik\dynagrid\DynaGrid |
$iconRemove | string | The icon for the save button within the dynagrid configuration form. | kartik\dynagrid\DynaGrid |
$iconSort | string | The icon that will be displayed as the label for grid sort personalization button. | kartik\dynagrid\DynaGrid |
$iconSortableSeparator | string | The icon that will be displayed separating the visible and hidden columns in the column reordering pane. | kartik\dynagrid\DynaGrid |
$iconVisibleColumn | string | The icon that will be displayed for each VISIBLE column heading in the column reordering pane. | kartik\dynagrid\DynaGrid |
$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 |
$krajeeDialogSettings | array | Configuration settings for the Krajee dialog widget that will be used to render alerts and confirmation dialog prompts | kartik\dynagrid\DynaGrid |
$matchPanelStyle | boolean | Whether the DynaGrid configuration button class should match the grid panel style. | kartik\dynagrid\DynaGrid |
$messageOptions | array | HTML attributes for the submission message container | kartik\dynagrid\DynaGrid |
$moduleId | string | The module identifier if this widget is part of a module. | kartik\dynagrid\DynaGrid |
$options | array | HTML options for the DynaGrid widget | kartik\dynagrid\DynaGrid |
$pjaxContainerId | string | The identifier for the PJAX widget container if the widget is to be rendered inside a PJAX container. | kartik\base\WidgetTrait |
$pjaxDuplicationFix | boolean | Prevent duplication of pjax containers when browser back & forward buttons are pressed. | kartik\base\WidgetTrait |
$pluginDestroyJs | string | The javascript that will be used to destroy the jQuery plugin | kartik\base\WidgetTrait |
$pluginEvents | array | Widget JQuery events. | kartik\base\WidgetTrait |
$pluginName | string | The plugin name | kartik\base\WidgetTrait |
$pluginOptions | array | Widget plugin options. | kartik\base\WidgetTrait |
$resetButtonOptions | array|boolean | The HTML attributes for the reset action button. | kartik\dynagrid\DynaGrid |
$showFilter | boolean | Whether to show the filter save widget button. | kartik\dynagrid\DynaGrid |
$showPersonalize | boolean | Whether to show the personalize button group. | kartik\dynagrid\DynaGrid |
$showSort | boolean | Whether to show the sort save widget button. | kartik\dynagrid\DynaGrid |
$sortableHeader | array | The HTML attributes for the sortable columns header | kartik\dynagrid\DynaGrid |
$sortableOptions | array | The sortable widget options | kartik\dynagrid\DynaGrid |
$sourcePath | string | Directory path to the original widget source. | kartik\base\WidgetTrait |
$stack | yii\base\Widget[] | The widgets that are currently being rendered (not ended). | yii\base\Widget |
$storage | string | The type of storage for the dynagrid configuration. | kartik\dynagrid\DynaGrid |
$submitButtonOptions | array | The HTML attributes for the save/apply action button. | kartik\dynagrid\DynaGrid |
$submitMessage | string | The message to display after applying and submitting the configuration and until refreshed grid is reloaded | kartik\dynagrid\DynaGrid |
$theme | string | The initial grid theme to be set | kartik\dynagrid\DynaGrid |
$toggleButtonFilter | array | The HTML attributes for the filter configuration button which will render the Filter settings form within a Bootstrap Modal container. | kartik\dynagrid\DynaGrid |
$toggleButtonGrid | array | The HTML attributes for the dynagrid personalize toggle button which will render the DynaGrid configuration form within a Bootstrap Modal container. | kartik\dynagrid\DynaGrid |
$toggleButtonSort | array | The HTML attributes for the sort configuration button which will render the Sort settings form within a Bootstrap Modal container. | kartik\dynagrid\DynaGrid |
$userSpecific | boolean | Whether settings are stored specific to each user | kartik\dynagrid\DynaGrid |
$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 |
Protected Properties
Property | Type | Description | Defined By |
---|---|---|---|
$_bsVer | integer | Current bootstrap version number | kartik\base\BootstrapTrait |
$_columns | array | The cached columns configuration | kartik\dynagrid\DynaGrid |
$_dataVar | string | The HTML5 data variable name that will be used to store the Json encoded pluginOptions within the element on which the jQuery plugin will be initialized. | kartik\base\WidgetTrait |
$_defaultBtnCss | string | Default bootstrap button CSS | kartik\base\BootstrapTrait |
$_defaultIconPrefix | string | Default icon CSS prefix | kartik\base\BootstrapTrait |
$_detailConfig | array | The dynagrid detail configuration settings (for filter and sort) | kartik\dynagrid\DynaGrid |
$_encOptions | string | The JSON encoded plugin options. | kartik\base\WidgetTrait |
$_filterId | integer | The grid filter id | kartik\dynagrid\DynaGrid |
$_filterKey | string | The unique element identifier for the hidden filter input | kartik\dynagrid\DynaGrid |
$_filterModalId | string | The identifier for the filter settings modal dialog | kartik\dynagrid\DynaGrid |
$_gridModalId | string | The identifier for the grid settings modal dialog | kartik\dynagrid\DynaGrid |
$_hashVar | string | The generated hashed variable name that will store the JSON encoded pluginOptions in yii\web\View::POS_HEAD. | kartik\base\WidgetTrait |
$_icons | array | The configuration for icons set as $key => $setting , where $key is the icon property in DynaGrid
widget and the $setting is an array of 2 values - the first value in the array is the icon suffix CSS class for
Bootstrap 3. |
kartik\dynagrid\DynaGrid |
$_isBs4 | boolean | Flag to detect whether bootstrap 4. | kartik\base\BootstrapTrait |
$_isPjax | boolean | Flag to check if the pjax is enabled for the grid | kartik\dynagrid\DynaGrid |
$_isSubmit | boolean | Flag to check if the grid configuration form has been submitted | kartik\dynagrid\DynaGrid |
$_model | kartik\dynagrid\models\DynaGridConfig | Model | kartik\dynagrid\DynaGrid |
$_module | kartik\dynagrid\Module | The current module | kartik\dynagrid\DynaGrid |
$_msgCat | string | Translation message file category name for i18n. | kartik\base\TranslationTrait |
$_pageSize | integer | The grid pagesize | kartik\dynagrid\DynaGrid |
$_pjaxId | string | The identifier for pjax container | kartik\dynagrid\DynaGrid |
$_requestSubmit | string | Request param name which will show the grid configuration submitted | kartik\dynagrid\DynaGrid |
$_sortId | integer | The grid sort id | kartik\dynagrid\DynaGrid |
$_sortKey | string | The unique element identifier for the hidden sort input | kartik\dynagrid\DynaGrid |
$_sortModalId | string | The identifier for the sort settings modal dialog | kartik\dynagrid\DynaGrid |
$_store | kartik\dynagrid\DynaGridStore | The storage instance | kartik\dynagrid\DynaGrid |
$_visibleColumns | array | The user configured visible widget columns | kartik\dynagrid\DynaGrid |
$_visibleKeys | array | The stored visible keys | kartik\dynagrid\DynaGrid |
Public Methods
Method | Description | Defined 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 |
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 |
getBSClass() | Gets the respective Bootstrap class based on currently configured bootstrap version. | kartik\base\BootstrapTrait |
getBaseSourcePath() | Get parsed base source path based on $sourcePath setting. If $sourcePath is not set, it will return the current working directory of this widget class. | kartik\base\WidgetTrait |
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 |
getCat() | Gets the category translated description | kartik\dynagrid\DynaGridTrait |
getColumns() | Gets the columns for the dynagrid | kartik\dynagrid\DynaGrid |
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 |
getDropdownClass() | Gets the respective bootstrap dropdown class name based on currently configured bootstrap version. | kartik\base\BootstrapTrait |
getId() | Returns the ID of the widget. | yii\base\Widget |
getView() | kartik\base\WidgetTrait | |
getViewPath() | Returns the directory containing the view files for this widget. | yii\base\Widget |
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 object. | yii\base\Widget |
initI18N() | Yii i18n messages configuration for generating translations | kartik\base\TranslationTrait |
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 |
registerWidgetJs() | Registers a JS code block for the widget. | kartik\base\WidgetTrait |
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 |
renderFile() | Renders a view file. | yii\base\Widget |
run() | Executes the widget. | kartik\dynagrid\DynaGrid |
setId() | Sets the ID of the widget. | yii\base\Widget |
setView() | Sets the view object to be used by this widget. | yii\base\Widget |
trigger() | Triggers an event. | yii\base\Component |
widget() | Creates a widget instance and runs it. | yii\base\Widget |
Protected Methods
Method | Description | Defined By |
---|---|---|
addAsset() | Adds an asset to the view. | kartik\base\WidgetTrait |
applyColumns() | Applies the configured columns | kartik\dynagrid\DynaGrid |
applyFilter() | Applies the grid filter | kartik\dynagrid\DynaGrid |
applyGridConfig() | Applies the current grid configuration | kartik\dynagrid\DynaGrid |
applyPageSize() | Applies the page size | kartik\dynagrid\DynaGrid |
applySort() | Applies the grid sort | kartik\dynagrid\DynaGrid |
applyTheme() | Applies the configured theme | kartik\dynagrid\DynaGrid |
canReorder() | Can the column be reordered | kartik\dynagrid\DynaGrid |
configureBsVersion() | Configures the bootstrap version settings | kartik\base\BootstrapTrait |
configureColumns() | Reconfigure columns with unique keys | kartik\dynagrid\DynaGrid |
fixPjaxDuplication() | Fix for weird PJAX container duplication behavior on pressing browser back and forward buttons. | kartik\base\WidgetTrait |
getAttributeLabel() | Generates the attribute label | kartik\dynagrid\DynaGrid |
getBsExtBasename() | The yii2-bootstrap extension base name. | kartik\base\BootstrapTrait |
getColumnKey() | Generate an unique column key | kartik\dynagrid\DynaGrid |
getColumnLabel() | Fetches the column label | kartik\dynagrid\DynaGrid |
getDefaultButtonOptions() | Get the default action button option settings | kartik\dynagrid\DynaGrid |
getGridConfig() | Gets the current grid configuration | kartik\dynagrid\DynaGrid |
getPluginScript() | Returns the plugin registration script. | kartik\base\WidgetTrait |
getSortableHeader() | Generates the config for sortable widget header | kartik\dynagrid\DynaGrid |
hashPluginOptions() | Generates a hashed variable to store the pluginOptions. | kartik\base\WidgetTrait |
initBsVersion() | Initializes bootstrap versions for the widgets and asset bundles. | kartik\base\BootstrapTrait |
initDataProvider() | Initialize the data provider | kartik\dynagrid\DynaGrid |
initDestroyJs() | Generates the pluginDestroyJs script if it is not set. |
kartik\base\WidgetTrait |
initGrid() | Initialize the grid view for dynagrid | kartik\dynagrid\DynaGrid |
initIcons() | Initializes icon properties with default values | kartik\dynagrid\DynaGrid |
initModule() | Initialize the module based on module identifier | kartik\dynagrid\DynaGrid |
initWidget() | Initializes widget settings and options | kartik\dynagrid\DynaGrid |
isSameVersion() | Compares two versions and checks if they are of the same major BS version. | kartik\base\BootstrapTrait |
isVisible() | Is column visible | kartik\dynagrid\DynaGrid |
loadAttributes() | Load configuration attributes into DynaGridConfig model | kartik\dynagrid\DynaGrid |
loadGridConfig() | Load grid configuration from specific storage | kartik\dynagrid\DynaGrid |
matchColumnString() | Finds the matches for a string column format | kartik\dynagrid\DynaGrid |
mergeDefaultOptions() | Merge default options | kartik\base\WidgetTrait |
parseData() | Parses the encoded grid configuration and fetches - grid master settings: the theme, pagesize, visible keys - grid detail settings: filter and sort configuration | kartik\dynagrid\DynaGrid |
parseDetailData() | Parses the grid detail configuration (for filter or sort). | kartik\dynagrid\DynaGrid |
parseVer() | Parses and returns the major BS version | kartik\base\BootstrapTrait |
pjaxCleanupJs() | Generates the cleanup client script for modals | kartik\dynagrid\DynaGrid |
prepareColumns() | Prepares the columns for the dynagrid | kartik\dynagrid\DynaGrid |
registerAssets() | Registers client assets | kartik\dynagrid\DynaGrid |
registerPlugin() | Registers a specific plugin and the related events | kartik\base\WidgetTrait |
registerPluginOptions() | Registers plugin options by storing within a uniquely generated javascript variable. | kartik\base\WidgetTrait |
renderActionButton() | Renders the action button | kartik\dynagrid\DynaGrid |
saveGridConfig() | Update configuration | kartik\dynagrid\DynaGrid |
setDataVar() | Sets a HTML5 data variable. | kartik\base\WidgetTrait |
setToggleButton() | Sets the personalization toggle button | kartik\dynagrid\DynaGrid |
setWidgetColumns() | Sets widget columns for display in kartik\sortable\Sortable widget | kartik\dynagrid\DynaGrid |
Events
Event | Type | Description | Defined 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
Constant | Value | Description | Defined By |
---|---|---|---|
ORDER_FIX_LEFT | 'fixleft' | kartik\dynagrid\DynaGrid | |
ORDER_FIX_RIGHT | 'fixright' | kartik\dynagrid\DynaGrid | |
ORDER_MIDDLE | 'middle' | kartik\dynagrid\DynaGrid | |
TYPE_COOKIE | 'cookie' | kartik\dynagrid\DynaGrid | |
TYPE_DB | 'db' | kartik\dynagrid\DynaGrid | |
TYPE_SESSION | 'session' | kartik\dynagrid\DynaGrid |
Property Details
The cached columns configuration
The dynagrid detail configuration settings (for filter and sort)
The grid filter id
The unique element identifier for the hidden filter input
The identifier for the filter settings modal dialog
The identifier for the grid settings modal dialog
The hidden widget columns for user configuration
The configuration for icons set as $key => $setting
, where $key
is the icon property in DynaGrid
widget and the $setting
is an array of 2 values - the first value in the array is the icon suffix CSS class for
Bootstrap 3.x and the second value in the array is the icon suffix CSS class for Bootstrap 4.x.
'iconVisibleColumn' => ['eye-open', 'eye'], 'iconHiddenColumn' => ['eye-close', 'eye-slash'], 'iconSortableSeparator' => ['resize-horizontal', 'arrows-alt-h'], 'iconPersonalize' => ['wrench', 'wrench fa-fw'], 'iconFilter' => ['filter', 'filter fa-fw'], 'iconSort' => ['sort', 'sort fa-fw'], 'iconConfirm' => ['ok', 'check'], 'iconRemove' => ['remove', 'times']
]
Flag to check if the pjax is enabled for the grid
Flag to check if the grid configuration form has been submitted
Model
The current module
The grid pagesize
The identifier for pjax container
Request param name which will show the grid configuration submitted
The grid sort id
The unique element identifier for the hidden sort input
The identifier for the sort settings modal dialog
The storage instance
The user configured visible widget columns
The stored visible keys
Whether to allow display/setup of the filter in the personalize grid form
Whether to allow setup of the pagination. Defaults to true
.
Whether to allow display/setup of the sort in the personalize grid form
Whether to allow display/setup of the theme. Defaults to true
.
The grid columns configuration
Whether to update only the name, when editing and saving a filter or sort. This is applicable
only for $storage set to Dynagrid::TYPE_DB. If set to false
, it will also overwrite the current
filter
or sort
settings.
The HTML attributes for the delete/trash action button. If this is set to false
, it will
not be displayed. The following special variables are supported:
icon
: string, the icon class suffix for the button. Defaults totrash
for $bsVersion set to3.x
andtrash-alt
for $bsVersion set to4.x
.prefix
: string, the icon class prefix for the button. Defaults toglyphicon glyphicon-
for $bsVersion set to3.x
andfas fa-
for $bsVersion set to4.x
.label
: string, the label for the action button. Defaults to empty string.title
: string, the title for the action button. Defaults toRemove saved grid settings
.
The confirmation warning message before deleting a personalization configuration or setting.
The message to display after deleting the configuration and until refreshed grid is reloaded
Whether to enable multiple sort. Defaults to true
.
Widget options for \kartik\widgets\GridView that will be rendered by the DynaGrid widget
The icon for the save button within the dynagrid configuration form. This is not HTML encoded.
Defaults to <i class="glyphicon glyphicon-save"></i>
for $bsVersion set to 3.x
and
<i class="fas fa-save"></i>
for $bsVersion set to 4.x
.
The icon that will be displayed as the label for grid filter personalization button. This is not
HTML encoded. Defaults to <i class="glyphicon glyphicon-filter"></i>
for $bsVersion set to 3.x
and
<i class="fas fa-fw fa-filter"></i>
for $bsVersion set to 4.x
.
The icon that will be displayed for each HIDDEN column heading in the column reordering pane.
This is not HTML encoded. Defaults to <i class="glyphicon glyphicon-eye-close"></i>
for $bsVersion
set to 3.x
and <i class="fas fa-eye-slash"></i>
for $bsVersion set to 4.x
.
The icon that will be displayed on the dynagrid personalize button as well as the personalize modal
dialog header. This is not HTML encoded. Defaults to <i class="glyphicon glyphicon-wrench"></i>
for
$bsVersion set to 3.x
and <i class="fas fa-fw fa-wrench"></i>
for $bsVersion set to 4.x
.
The icon for the save button within the dynagrid configuration form. This is not HTML encoded.
Defaults to <i class="glyphicon glyphicon-remove"></i>
for $bsVersion set to 3.x
and
<i class="fas fa-times"></i>
for $bsVersion set to 4.x
.
The icon that will be displayed as the label for grid sort personalization button. This is not
HTML encoded. Defaults to <i class="glyphicon glyphicon-sort"></i>
for $bsVersion set to 3.x
and
<i class="fas fa-fw fa-sort"></i>
for $bsVersion set to 4.x
.
The icon that will be displayed separating the visible and hidden columns in the column reordering
pane. This is not HTML encoded. Defaults to <i class="glyphicon glyphicon-resize-horizontal"></i>
for
$bsVersion set to 3.x
and <i class="fas fa-arrows-alt-h"></i>
for $bsVersion set to 4.x
.
The icon that will be displayed for each VISIBLE column heading in the column reordering pane.
This is not HTML encoded. Defaults to <i class="glyphicon glyphicon-eye-open"></i>
for $bsVersion
set to 3.x
and <i class="fas fa-eye"></i>
for $bsVersion set to 4.x
.
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.
Whether the DynaGrid configuration button class should match the grid panel style.
HTML attributes for the submission message container
The module identifier if this widget is part of a module. If not set, the module identifier will
be auto derived based on the \yii\base\Module::getInstance method. This can be useful, if you are setting
multiple module identifiers for the same module in your Yii configuration file. To specify children or grand
children modules you can specify the module identifiers relative to the parent module (e.g. admin/content
).
HTML options for the DynaGrid widget
The HTML attributes for the reset action button. If this is set to false
, it will not be
displayed. The following special variables are supported:
icon
: string, the icon class suffix for the button. Defaults torepeat
for $bsVersion set to3.x
andredo
for $bsVersion set to4.x
.prefix
: string, the icon class prefix for the button. Defaults toglyphicon glyphicon-
for $bsVersion set to3.x
andfas fa-
for $bsVersion set to4.x
.label
: string, the label for the action button. Defaults to empty string.title
: string, the title for the action button. Defaults toAbort any changes and reset settings
.
Whether to show the filter save widget button. Defaults to true
.
Whether to show the personalize button group. Defaults to true
.
Whether to show the sort save widget button. Defaults to true
.
The HTML attributes for the sortable columns header
The sortable widget options
The type of storage for the dynagrid configuration.
- kartik\dynagrid\DynaGrid::TYPE_SESSION: Save the config in a session variable for the current session.
- kartik\dynagrid\DynaGrid::TYPE_COOKIE: Save the config in a cookie for retrieval. You need to setup the kartik\dynagrid\Module::$cookieSettings property to control the cookie expiry and other settings.
- kartik\dynagrid\DynaGrid::TYPE_DB: Save the config to a database. You need to setup the kartik\dynagrid\Module::$dbSettings property to setup the database table and attributes for storage.
The HTML attributes for the save/apply action button. If this is set to false
, it will not be
displayed. The following special variables are supported:
icon
: string, the icon class suffix for the button. Defaults tosave
.prefix
: string, the icon class prefix for the button. Defaults toglyphicon glyphicon-
for $bsVersion set to3.x
andfas fa-
for $bsVersion set to4.x
.label
: string, the label for the action button. Defaults to empty string.title
: string, the title for the action button. Defaults toSave grid settings
.
The message to display after applying and submitting the configuration and until refreshed grid is reloaded
The initial grid theme to be set
The HTML attributes for the filter configuration button which will render the Filter settings form within a Bootstrap Modal container.
The HTML attributes for the dynagrid personalize toggle button which will render the DynaGrid configuration form within a Bootstrap Modal container.
The HTML attributes for the sort configuration button which will render the Sort settings form within a Bootstrap Modal container.
Whether settings are stored specific to each user
Method Details
Applies the configured columns
protected void applyColumns ( ) |
Applies the grid filter
protected void applyFilter ( ) |
Applies the current grid configuration
protected void applyGridConfig ( ) | ||
throws | yii\base\InvalidConfigException |
---|
Applies the page size
protected void applyPageSize ( ) |
Applies the grid sort
protected void applySort ( ) |
Applies the configured theme
protected void applyTheme ( ) |
Can the column be reordered
protected boolean canReorder ( $column ) | ||
$column | mixed | |
throws | Exception |
---|
Reconfigure columns with unique keys
protected void configureColumns ( ) | ||
throws | yii\base\InvalidConfigException |
---|
Generates the attribute label
protected string getAttributeLabel ( $attribute ) | ||
$attribute |
Generate an unique column key
protected false|string getColumnKey ( $column ) | ||
$column | mixed | |
throws | yii\base\InvalidConfigException |
---|
Fetches the column label
protected string getColumnLabel ( $key, $column ) | ||
$key | mixed | The column key |
$column | mixed | The column object / configuration |
throws | yii\base\InvalidConfigException |
---|
Gets the columns for the dynagrid
public array getColumns ( ) |
Get the default action button option settings
protected array getDefaultButtonOptions ( $type ) | ||
$type | string | The button type |
return | array | The button settings |
---|---|---|
throws | \yii\base\InvalidConfigException|\Exception |
Gets the current grid configuration
protected array getGridConfig ( $current = false ) | ||
$current | boolean | Whether it is the currently set grid configuraton |
throws | yii\base\InvalidConfigException |
---|
Generates the config for sortable widget header
protected array getSortableHeader ( $label ) | ||
$label | string |
Initialize the data provider
protected void initDataProvider ( $searchModel ) | ||
$searchModel | yii\base\Model |
Initialize the grid view for dynagrid
protected void initGrid ( ) | ||
throws | yii\base\InvalidConfigException | |
---|---|---|
throws | Exception |
Initializes icon properties with default values
protected void initIcons ( ) | ||
throws | \yii\base\InvalidConfigException|\Exception |
---|
Initialize the module based on module identifier
protected void initModule ( ) | ||
throws | yii\base\InvalidConfigException |
---|
Initializes widget settings and options
protected void initWidget ( ) | ||
throws | yii\base\InvalidConfigException |
---|
Is column visible
protected static boolean isVisible ( $column ) | ||
$column | mixed | |
throws | Exception |
---|
Load configuration attributes into DynaGridConfig model
protected void loadAttributes ( $model ) | ||
$model | kartik\dynagrid\models\DynaGridConfig | |
throws | yii\base\InvalidConfigException |
---|
Load grid configuration from specific storage
protected void loadGridConfig ( $config = [] ) | ||
$config | array | The configuration to load |
throws | yii\base\InvalidConfigException |
---|
Finds the matches for a string column format
protected array matchColumnString ( $column ) | ||
$column | string | |
throws | yii\base\InvalidConfigException |
---|
Parses the encoded grid configuration and fetches - grid master settings: the theme, pagesize, visible keys - grid detail settings: filter and sort configuration
protected void parseData ( $data ) | ||
$data | array | The stored data to be parsed |
throws | yii\base\InvalidConfigException |
---|
Parses the grid detail configuration (for filter or sort).
protected void parseDetailData ( $category ) | ||
$category | string | One of 'filter' or 'sort' |
throws | yii\base\InvalidConfigException |
---|
Generates the cleanup client script for modals
protected string pjaxCleanupJs ( $type ) | ||
$type | string | The modal container type 'grid', 'filter', or 'sort' |
Prepares the columns for the dynagrid
protected void prepareColumns ( ) |
Registers client assets
protected void registerAssets ( ) | ||
throws | Exception |
---|
Renders the action button
protected string renderActionButton ( $type ) | ||
$type | string | The button type |
return | string | The rendered button |
---|---|---|
throws | yii\base\InvalidConfigException |
Executes the widget.
public string|void run ( ) | ||
return | string|void | The rendering result may be directly "echoed" or returned as a string |
---|---|---|
throws | yii\base\InvalidConfigException | |
throws | Exception |
Update configuration
protected void saveGridConfig ( $config, $delete ) | ||
$config | array | The dynagrid configuration |
$delete | boolean | The deletion flag |
throws | yii\base\InvalidConfigException |
---|
Sets the personalization toggle button
protected void setToggleButton ( $cat ) | ||
$cat | string | The category 'grid', 'filter', or 'sort' |
throws | \yii\base\InvalidConfigException|\Exception |
---|
Sets widget columns for display in kartik\sortable\Sortable widget
protected void setWidgetColumns ( ) | ||
throws | yii\base\InvalidConfigException |
---|