Buttons
Controls operations are triggered by operation buttons, that is, by cliccable dom nodes
with a data-operatinion="operation_name arg1 arg2..."
.
Row buttons are automatically created by default
templates according to the specifications provided in the operations
row-type
attribute.
Buttons placed in toolbars such as the add new item button
of a grid must be created manually.
No event handler is attached directly to buttons, so they work immediately also when they are rendered dynamically. There are just a few handlers attached directly to the document that handle all Mvc Controls Toolkit controls, by exploiting event bubbling.
Below all button operations supported up to now by at least one control.
- add append|prepend|after|before [row-index]
-
It adds a new item in line in a collection control (like a grid, for instance).
after|before may be used just when the button is on a data item, and cause the new item be added
after|before the data item whose button was clicked.
row-index
is the index of therow-type
whose specifications will be used to create the new item. Ifrow-index
is not provided, the new item will have the samerow-type
of the the data item whose button was clicked. append|prepend are used when the button is placed in a toolbar, and cause the new item be appended/prepended to all others. Ifrow-index
is not provided 0 (that is the main row) is assumed. append|prepend may be processed also if the button is placed out of the control, but in this case the button must contain adata-target
attribute whose value is the id of the control to be processed. - add-detail append|prepend|after|before [row-index]
-
Works as
add
but new record is edited in a modal window. - delete
- It deletes the data item whose button was clicked.
- show-detail
- It shows in detail display only mode the data item whose button was clicked.
- edit
- It moves the data item whose button was clicked from display mode to edit mode.
- edit-detail
- It opens a modal to edit the data item whose button was clicked in detail mode.
- save
- It saves changes to the data item being edited to the server, and if edit took place in a modal it closes the modal, too. In case of detail mode editing, this button must be placed in the form of the modal window.
- undo
- It undo the data item whose button was clicked and, if in edit mode, moves back to display mode
- close
- It closes a modal window opened to show/edit a data item in detail mode. This button must be placed withing the modal window.