SMART datagrid provides many ways for the user to directly append or delete rows and update the value with using cell editor during the run time. And, it fires events in each point of editing activities to enable the developer to implement UI which meets application requirements.
In the grid, user editing can be implemented in various ways according to the application thus can be very complex.
If type F2 key or double click the mouse after moving the focus to data cell to edit, the editor set in the column will be displayed. And, if start typing in data cell which has the focus, the editor will be displayed with starting input.
You can also display the editor by calling GridBase.showEditor. Just before displaying the editor, GridBase.onShowEditor event will be fired.
If type Esc key when the editor is being displayed, cell editing will be cancelled, and the editor will be closed with ignoring the value entered in the editor. Just after closing the editor, GridBase.onEditCanceled event will be fired. You can also call GridBase.cancelEditor to cancel cell editing. And, if you want to cancel row editing, you can type Esc key again when the editor has not been displayed.
In order to commit cell editing, you can type Enter key or move the focus to another cell with using keyboard or mouse. At this point, if move to the cell of another row, cell editing will be committed at the same time when commit row editing. You can also directly call GridBase.commitEditor to commit editing.
Just before committing cell editing, Validation will be run, and once validation is committed, the entered value will be reflected with firing GridBase.onEditCommitted and GridBase.onEditCellUpdated events one after another. At this point, in order to transfer another value rather than the one entered by the user in the editor, you can set editResult.value as another value in DataColumn.editCallback function.
You can type Esc key or call cancelEditor method to cancel cell editing.
If do not specify EditOptions.updateByCell as true, SMART datagrid will basically operate row editing. In other words, it will commit or cancel full row editing. Only if row editing is committed, values entered in the data set will be transferred.
In order to commit editing, you can change the row location with using arrow keys or clicking the mouse. And, you can also directly call GridBase.commit method. In order to cancel editing, you can type Esc key when the editor has not been displayed. In other words, if the editor is being displayed, you can type Esc key twice. And, you can also call cancel method.
When the user edits cells with using cell editors, Grid events can be fired in the order as listed in the table below.
Event | Explanation |
---|---|
onShowEditor(grid, index) | It will be fired just before displaying the editor. If explicitly return false within this event handler, the editor will not be displayed. |
onEditChanged | It will be fired whenever the content in the editor is updated. |
onEditCanceled | It will be fired when cell editing is cancelled. |
editCallback | Editing can be committed with another value rather than the user editing one within this callback function. |
onEditCommitted | It will be fired if cell editing is committed normally. |
onEditCellUpdated | It will be fired if the entered value is different from the existing one when editing is committed. |
onEditRowPasted | It will be fired when clipboard pasting occurs in editing row. |
onEditSearch | It is the event of requesting items which will be displayed in the list by SearchCellEditor. |
onEditRowCommitted | It will be fired after row editing is committed. |
onEditRowCanceled | It will be fired after row editing is cancelled. |
onPasted | It will be fired after clipboard pasting is committed. |
Currently, SMART datagrid provides cell editors as listed in the table below. You can set the type and property of the editor through DataColumn.editor property.
Types | Explanation | Main properties |
---|---|---|
'line' LineCellEditor | Text Editor of one line. The default Editor | maxLength - Maximum input length |
'list' ListCellEditor | Text Editor of displaying configurable list in list box. | |
'multiline' MultiLineCellEditor | Text Editor of multiple lines | maxLength - Maximum input length |
'number' NumberCellEditor | Number Editor | positiveOnly - Enter positive values only maxDigits - Decimal digits |
'date' DateCellEditor | Date Editor of displaying calendar list | yearNavigation - Display year change button showToday - Display show today button |
'search' SearchCellEditor | List Editor of changing the list of list according to the condition | keyLength - Minimum text length of requesting a list searchDelay - Waiting period before firing request event after entering |
If it is now doing Row Editing, it will not proceed Sorting, Filtering, Row Grouping, Paging.
If it is now doing Row Editing, it will not allow to Change Data Set with throwing an exception "Client being edited".