The html options to be applied to the default button.
The button rendering callbacks. The array keys are the button names (without curly brackets), and the values are the corresponding button rendering callbacks. The callbacks should use the following signature:
function (url, model, key) {
// return the button HTML code
}
where $url
is the URL that the column creates for the button, $model
is the model object
being rendered for the current row, and $key
is the key of the model in the data provider array.
You can add further conditions to the button, for example only display it, when the model is editable (here assuming you have a status field that indicates that):
{
update: function(url, model, key) {
return model.status === 'editable' ? Html.a('Update', url) : '';
},
},
This is a callable that will be used to generate the content of each cell.
The signature of the function should be the following: function (model, key, index, column)
.
Where model
, key
, and index
refer to the model, key and index of the row currently being rendered
and column
is a reference to the Column object.
Closure the HTML attributes for the data cell tag. This can either be an array of
attributes or an anonymous function ([[Closure]]) that returns such an array.
The signature of the function should be the following: function (model, key, index, column)
.
Where model
, key
, and index
refer to the model, key and index of the row currently being rendered
and column
is a reference to the Column object.
A function may be used to assign different attributes to different rows based on the data in that row.
The HTML attributes for the filter cell tag.
The footer cell content. Note that it will not be HTML-encoded.
The HTML attributes for the footer cell tag.
The grid view object that owns this column.
The header cell content. Note that it will not be HTML-encoded.
The HTML attributes for the header cell tag.
The array keys are the icon names and the values the corresponding html:
{
eye-open: '<svg ...></svg>',
pencil: Html.tag('span', '', [ {class: 'glyphicon glyphicon-pencil'})
}
Defaults to FontAwesome 5 free svg icons.
A Promise which resolves when this Component has been successfully initialized.
The HTML attributes for the column group tag.
The template used for composing each cell in the action column.
Tokens enclosed within curly brackets are treated as controller action IDs (also called button names
in the context of action column). They will be replaced by the corresponding button rendering callbacks
specified in buttons. For example, the token {view}
will be replaced by the result of
the callback buttons['view']
. If a callback cannot be found, the token will be replaced with an empty string.
As an example, to only have the view, and update button you can add the ActionColumn to your GridView columns as follows:
{class: 'ActionColumn', template: '{view} {update}'},
Whether this column is visible. Defaults to true.
The visibility conditions for each button. The array keys are the button names (without curly brackets), and the values are the boolean true/false or the anonymous function. When the button name is not specified in this array it will be shown by default. The callbacks must use the following signature:
function (model, key, index) {
return model.status === 'editable';
}
Or you can pass a boolean value:
{
update: true
}
Creates a URL for the given action and model. This method is called for each button and each row.
the button name (or action ID)
the key associated with the data model
the current row index
the created URL
Returns header cell label. This method may be overridden to customize the label of the header cell.
label
Initializes the object. This method is invoked at the end of the constructor after the object is initialized with the given configuration.
Initializes the default button rendering callback for single button.
Button name as it's written in template
Part of Bootstrap glyphicon class that makes it unique
Array of additional options
Initializes the default button rendering callbacks.
Renders a data cell.
the data model being rendered
the key associated with the data model
the zero-based index of the data item among the item array returned by GridView.dataProvider.
the rendering result
Renders the data cell content.
the data model
the key associated with the data model
the zero-based index of the data model among the models array returned by GridView.dataProvider.
the rendering result
Renders the filter cell.
Renders the filter cell content. The default implementation simply renders a space. This method may be overridden to customize the rendering of the filter cell (if any).
the rendering result
Renders the footer cell.
Renders the footer cell content. The default implementation simply renders footer. This method may be overridden to customize the rendering of the footer cell.
the rendering result
Renders the header cell.
Renders the header cell content. The default implementation simply renders header. This method may be overridden to customize the rendering of the header cell.
the rendering result
Generated using TypeDoc
ActionColumn is a column for the GridView widget that displays buttons for viewing and manipulating the items.
To add an ActionColumn to the gridview, add it to the [[GridView::columns|columns]] configuration as follows:
For more details and usage information on ActionColumn, see the guide article on data widgets.