Components.ModelsTableCellEditToggle Class
Component for cells used as toggle for edit-mode.
Properties and event-handlers from models-table/cell are bound here
Usage example:
<ModelsTable
@data={{data}}
@columns={{columns}}
@columnComponents={{hash
editRow=(component
"models-table/cell-edit-toggle"
saveRowAction=(action "onSaveRow")
cancelRowAction=(action "onCancelRow")
)}}
/>
import Controller from '@ember/controller';
import {action} from '@ember/object';
export default class InLineEditController extends Controller {
data = [];
columns = [
{propertyName: 'firstName'},
{propertyName: 'lastName'},
{
title: 'Edit',
component: 'editRow',
editable: false // <--- IMPORTANT
}
];
@action
onSaveRow(param) {
return param.record.save();
}
@action
onCancelRow({record}) {
record.rollbackAttributes();
return true;
}
}
Item Index
Properties
Properties
cancelButtonLabel
String
protected
The label for the Cancel Button
Default: themeInstance.cancelRowButtonLabelMsg
editButtonLabel
String
protected
The label for the Edit Button
Default: themeInstance.editRowButtonLabelMsg
saveButtonLabel
String
protected
The label for the Save Button
Default: themeInstance.saveRowButtonLabelMsg
Events
cancelClicked
protected
Fires when "Cancel Edit" button is clicked. Edit-mode for row is turned off
cancelEditRow
Closure action ModelsTableRow.cancelEditRow
cancelRowAction
Closure action sent on Cancel Button being clicked
Action will send one parameter - object with fields:
record
- The record currently being edited
collapseAllRows
Closure action ModelsTable.collapseAllRows
collapseRow
Closure action ModelsTable.collapseRow
editClicked
protected
Fires when "Edit" button is clicked. Edit-mode for row is turned on
editRow
Closure action ModelsTableRow.editRow
editRowAction
Closure action sent on Edit Button being clicked
Action will send one parameter - object with fields:
record
- The record to be edited
expandAllRows
Closure action ModelsTable.expandAllRows
expandRow
Closure action ModelsTable.expandRow
saveClicked
protected
Fires when "Save" button is clicked. Edit-mode for row is turned off
saveRow
Closure action ModelsTableRow.saveRow
saveRowAction
Closure action sent on Save Button being clicked
Action will send one parameter - object with fields:
record
- The record to be saved