Test doc
The caption of the grid table
The HTML attributes for the caption element.
Grid column configuration. Each array element represents the configuration for one particular grid column. For example,
[
{ class: SerialColumn },
{
class: DataColumn, // this line is optional
attribute: 'name',
label: 'Name',
},
{ class: CheckboxColumn },
]
If a column is of class DataColumn, the "class" property can be omitted.
As a shortcut format, a string may be used to specify the configuration of a data column
which only contains attribute
and/or label options: "attribute:format:label"
.
For example, the above "name" column can also be specified as: "name:text:Name"
.
Both "format" and "label" are optional. They will take default values if absent.
Using the shortcut format the configuration for columns in simple cases would look like this:
[
'id',
'amount:text:Total Amount',
'created_at:text',
]
Note: Format is now restricted to 'text' only. You can convert the data to a specific format by using callbacks as of now:
[ 'id', 'title:text:Company Name', { title: 'Created Date', value: (model, attribute) => (new Date(form.startDate.value)).toString('dd MMMM yyyy') } ]
When using a dataProvider with active records, you can also display values from related records,
e.g. the name
attribute of the author
relation:
// shortcut syntax
'author.name',
// full syntax
{
attribute: 'author.name',
// ...
}
The default data column class if the class name is not explicitly specified when configuring a data column. Defaults to 'DataColumn'.
The HTML display when the content of a cell is empty. This property is used to render cells that have no defined content, e.g. empty footer or filter cells.
The HTML content to be displayed when dataProvider does not have any data.
When this is set to false
no extra HTML content will be generated.
The default value is the text "No results found."
Whether to enable Pjax on this widget.
The options for rendering every filter error message. This is mainly used by Html.error when rendering an error message next to every filter input field.
The options for rendering the filter error summary. Please refer to Html.errorSummary for more details about how to specify the options.
The model that keeps the user-entered filter data. When this property is set, the grid view will enable column-based filtering. Each data column by default will display a text field at the top that users can fill in to filter the data.
Note that in order to show an input field for filtering, a column must have its DataColumn.attribute property set and the attribute should be active in the current scenario of $filterModel or have DataColumn.filter set as the HTML code for the input field.
When this property is not set (null) the filtering feature is disabled.
Whatever to apply filters on losing focus. Leaves an ability to manage filters via gridView JS
Whether the filters should be displayed in the grid view. Valid values include:
The HTML attributes for the filter row element.
Additional jQuery selector for selecting filter input fields
The URL for returning the filtering result. [[Url.to]] will be called to normalize the URL. If not set, the current controller action will be used. When the user makes change to any filter input, the current filtering inputs will be appended as GET parameters to this URL.
The HTML attributes for the table footer row.
The HTML attributes for the table header row.
A Promise which resolves when this Component has been successfully initialized.
The layout that determines how different sections of the grid view should be organized. The following tokens will be replaced with the corresponding section contents:
{summary}
: the summary section. See [[renderSummary()]].{errors}
: the filter model error summary. See [[renderErrors()]].{items}
: the list items. See [[renderItems()]].{sorter}
: the sorter. See [[renderSorter()]].{pager}
: the pager. See [[renderPager()]].The HTML attributes for the container tag of the grid view. The "tag" element specifies the tag name of the container element and defaults to "div".
The configuration for the pager widget. By default, LinkPager will be
used to render the pager. You can use a different widget class by configuring the "class" property.
Note that the widget must support the pagination
property which will be populated with the
[[DataProvider.pagination|pagination]] value of the dataProvider and will overwrite this value.
Whether to place footer after body in DOM if $showFooter is true
The HTML attributes for the table body rows.
Whether to show the footer section of the grid table.
Whether to show the header section of the grid table.
Whether to show the grid view if dataProvider returns no data.
The configuration for the sorter widget. By default, LinkSorter will be
used to render the sorter. You can use a different widget class by configuring the "class" property.
Note that the widget must support the sort
property which will be populated with the
[[DataProvider.sort|sort]] value of the dataProvider and will overwrite this value.
The HTML content to be displayed as the summary of the list view. If you do not want to show the summary, you may set it with an empty string.
The following tokens will be replaced with the corresponding values:
{begin}
: the starting row number (1-based) currently being displayed{end}
: the ending row number (1-based) currently being displayed{count}
: the number of rows currently being displayed{totalCount}
: the total number of rows available{page}
: the page number (1-based) current being displayed{pageCount}
: the number of pages availableThe HTML attributes for the summary of the list view. The "tag" element specifies the tag name of the summary element and defaults to "div".
The HTML attributes for the grid table element.
The prefix to the automatically generated widget IDs.
A counter used to generate id for widgets.
Creates a DataColumn object based on a string in the format of "attribute:format:label".
the column specification string
the column instance
Returns the options for the grid view JS widget.
the options
Returns the ID of the widget.
ID of the widget.
This function tries to guess the columns to show from the given data if columns are not explicitly specified.
Initializes the grid view. This method will initialize required property values and instantiate columns objects.
Creates column objects and initializes them.
Renders a widget.
string the rendering result.
Renders the caption element.
the rendered caption element or false
if no caption element should be rendered.
Renders the column group HTML.
the column group HTML or false
if no column group should be rendered.
Renders the HTML content indicating that the list view has no data.
string the rendering result
Renders validator errors of filter model.
the rendering result.
Renders the filter.
the rendering result.
Renders the data models for the grid view.
the HTML code of table
Renders the pager.
string the rendering result
Renders a section of the specified name. If the named section is not supported, false will be returned.
the section name, e.g., {summary}
, {items}
.
the rendering result of the section, or false if the named section is not supported.
Renders the sorter.
string the rendering result
Renders the summary text.
Renders the table body.
the rendering result.
Renders the table footer.
the rendering result.
Renders the table header.
the rendering result.
Renders a table row with the given data model and key.
the data model to be rendered
the key associated with the data model
the zero-based index of the data model among the model array returned by dataProvider.
the rendering result
Runs the widget.
Generated using TypeDoc
The GridView widget is used to display data in a grid.
It provides features like sorting, paging and also filtering the data.
A basic usage looks like the following:
The columns of the grid table are configured in terms of Column classes, which are configured via columns.
The look and feel of a grid view can be customized using the large amount of properties.
For more details and usage information on GridView, see the guide article on data widgets.
Mahesh S Warrier maheshs60@gmail.com
1.0