SMART datagrid v.1 > Concepts

Back  Forward

Concepts.Cell Editing Overview

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. 

1. Open and Close Editor

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. 

2. Commit and Cancel Editing

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. 

3. Commit and Cancel Row 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. 

4. Editing Events

When the user edits cells with using cell editors, Grid events can be fired in the order as listed in the table below. 

Table-1  Editing Events
EventExplanation
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.
onEditChangedIt will be fired whenever the content in the editor is updated.
onEditCanceledIt will be fired when cell editing is cancelled.
editCallbackEditing can be committed with another value rather than the user editing one within this callback function.
onEditCommittedIt will be fired if cell editing is committed normally.
onEditCellUpdatedIt will be fired if the entered value is different from the existing one when editing is committed.
onEditRowPastedIt will be fired when clipboard pasting occurs in editing row.
onEditSearchIt is the event of requesting items which will be displayed in the list by SearchCellEditor.
onEditRowCommittedIt will be fired after row editing is committed.
onEditRowCanceledIt will be fired after row editing is cancelled.
onPastedIt will be fired after clipboard pasting is committed.
5. Select Cell Editors

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. 

Table-2  Cell Editors
TypesExplanationMain properties
'line'
LineCellEditor
Text Editor of one line. The default EditormaxLength - Maximum input length
'list'
ListCellEditor
Text Editor of displaying configurable list in list box.
'multiline'
MultiLineCellEditor
Text Editor of multiple linesmaxLength - Maximum input length
'number'
NumberCellEditor
Number EditorpositiveOnly - Enter positive values only
maxDigits - Decimal digits
'date'
DateCellEditor
Date Editor of displaying calendar listyearNavigation - Display year change button
showToday - Display show today button
'search'
SearchCellEditor
List Editor of changing the list of list according to the conditionkeyLength - Minimum text length of requesting a list
searchDelay - Waiting period before firing request event after entering
6. Sorting, Filtering, Grouping, Paging during Editing

If it is now doing Row Editing, it will not proceed Sorting, Filtering, Row Grouping, Paging. 

7. Change Data Set during Editing

If it is now doing Row Editing, it will not allow to Change Data Set with throwing an exception "Client being edited"

See Also
TextCellEditor
DateCellEditor
CheckCellRenderer
DataColumn
Examples
Cell Editing
Text Editors
Date Editor
Check Cell Renderer