BiInlineEditModel

This class is used to handle inline editing in a BiTreeView and a BiOlapGrid. This class provides editing by using one attached component at a time.

This class extends BiAttachedComponentModel and therefore all methods and fields available for BiAttachedComponentModel are also available for BiInlineEditModel .

Constructor

new BiInlineEditModel ( )

Parameters

No parameters.

Properties

Name Type get set Descripton
column Number checked The column that is edited
currentEditComponent BiComponent checked The attached component that is used to edit the value of the cell
isEditing Boolean checked Whether we are currently editing a cell
row Number checked The row that is edited
value Object checked checked The value of the currently editing cell

Methods

Name Description
cancelEdit Ends the current editing of the cell without raising a change event
commitEdit Ends the current editing of the cell but fires of a change event
createAttachedComponent Creates an attached component for a certain type. This implementation supports BiInlineEditModel.EDIT_TYPE_STRING (BiTextBox), BiInlineEditModel.EDIT_TYPE_ENUM (BiComboBox), BiInlineEditModel.EDIT_TYPE_NUMBER (BiSpinner) and BiInlineEditModel.EDIT_TYPE_BOOLEAN (BiCheckBox). You may override this to add your own components. If you do, you will have to add an event-listener that sets the text on this model to the component's value when it changes.
getCanEdit Whether we can edit the cell at the given position
getEditOptions This provides some options for the current edit component. The type of Object returned is not well defined and different edit types uses different options.

For EDIT_TYPE_NUMBER the object can contain a field called maximum and a field called minimum and these will be used as properties on the BiSpinner.

For EDIT_TYPE_ENUM, which is displayed as a combo box, the options describe the items in the combo box and the options object can be an array of objects with text and userValue fields.
getEditType Returns the type of editing we want to use for the cell at the given position
setEditCell Sets the cell to edit. This starts the editing of the cell and the attached component for that cell is shown and focused

Events

Name Type Bubbles Descripton
beforehide BiEvent This happens before the editing component is hidden. If the default action is prevented here the component is not removed from the tree view
beforeshow BiEvent This event is dispatched before the editing component is added to the BiTreeView component
change BiEvent This event is fired when the value of the currently editing cell has changed.
hide BiEvent When the editing component has been removed/hidden.

Static Methods

None.

Static Fields

Name Type Descripton
EDIT_TYPE_BOOLEAN Number Constant for editing a Boolean value. This shows a check-box for editing the value as the attached component
EDIT_TYPE_ENUM Number Constant for selection one value out of a few options. This type shows a BiComboBox as the attached component
EDIT_TYPE_NUMBER Number Constant for editing a number value. This shows a spinner for editing the value as the attached component
EDIT_TYPE_STRING Number Constant for editing a string value. This type shows a simple BiTextField as the attached component

Remarks

Method Details

cancelEdit

Ends the current editing of the cell without raising a change event

Syntax

object.cancelEdit
 (
 
 )
 

Parameters

No arguments.

Return Type

void

commitEdit

Ends the current editing of the cell but fires of a change event

Syntax

object.commitEdit
 (
 
 )
 

Parameters

No arguments.

Return Type

void

createAttachedComponent

Creates an attached component for a certain type. This implementation supports BiInlineEditModel.EDIT_TYPE_STRING (BiTextBox), BiInlineEditModel.EDIT_TYPE_ENUM (BiComboBox), BiInlineEditModel.EDIT_TYPE_NUMBER (BiSpinner) and BiInlineEditModel.EDIT_TYPE_BOOLEAN (BiCheckBox). You may override this to add your own components. If you do, you will have to add an event-listener that sets the text on this model to the component's value when it changes.

Syntax

object.createAttachedComponent
 (
 type
 )
 

Parameters

Name Type Optional Default Descripton
type Number The number returned by getEditType(x, y).

Return Type

BiComponent

getCanEdit

Whether we can edit the cell at the given position

Syntax

object.getCanEdit
 (
 x,y
 )
 

Parameters

Name Type Optional Default Descripton
x Number The column of the cell we want to edit
y Number The row of the cell we want to edit

Return Type

Boolean

getEditOptions

This provides some options for the current edit component. The type of Object returned is not well defined and different edit types uses different options.

For EDIT_TYPE_NUMBER the object can contain a field called maximum and a field called minimum and these will be used as properties on the BiSpinner.

For EDIT_TYPE_ENUM, which is displayed as a combo box, the options describe the items in the combo box and the options object can be an array of objects with text and userValue fields.

Syntax

object.getEditOptions
 (
 x,y
 )
 

Parameters

Name Type Optional Default Descripton
x Number The column of the editing cell
y Number The row of the editing cell

Return Type

Object

getEditType

Returns the type of editing we want to use for the cell at the given position

Syntax

object.getEditType
 (
 x,y
 )
 

Parameters

Name Type Optional Default Descripton
x Number The column of the cell we want to edit
y Number The row of the cell we want to edit

Return Type

Number

setEditCell

Sets the cell to edit. This starts the editing of the cell and the attached component for that cell is shown and focused

Syntax

object.setEditCell
 (
 x,y
 )
 

Parameters

Name Type Optional Default Descripton
x Number The column that the cell is at
y Number The row that the cell is at

Return Type

void