|
How to use the selectable rows feature? |
Answered by
sa-si-dev
May 29, 2021
Replies: 2 comments 3 replies
|
To enable the selectable rows feature, add the properties class GridComponent extends GridCoreComponent {
constructor(options) {
let defaultOptions = {
showSelectableCol: true,
selectedRowsActions: [
{ label: 'Delete', value: 'delete' },
{ label: 'Change Status', value: 'change_status' },
],
// selectedRowsActions: ['Delete', 'Change Status'], /** if label and value are same */
};
super(Object.assign(defaultOptions, options));
}
}Override isRowSelectable(rowData) {
/** return boolean value */
return rowData.status !== 'deleted';
}
/** OR */
isRowSelectable(rowData) {
let result = rowData.status !== 'deleted';
/** return object with message, to show tooltip while hover on checkbox */
if (!result) {
result = {
result,
message: 'No permission',
};
}
return result;
}Override onSelectedRowsActionClick(e) {
let action = DomUtils.getData(e.target, 'action');
let selectedRows = this.getSelectedRows();
alert(`Clicked action "${action}" for ${selectedRows.length} rows`);
} |
0 replies
Answer selected by
sa-si-dev
|
Could you add some examples with html to build tables when using the plugin? Thanks) |
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To enable the selectable rows feature, add the properties
showSelectableColandselectedRowsActionsOverride
isRowSelectablemethod to disable the checkbox for rows that don't have permission