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

NameTypegetsetDescripton
columnNumbercheckedThe column that is edited
currentEditComponentBiComponentcheckedThe attached component that is used to edit the value of the cell
isEditingBooleancheckedWhether we are currently editing a cell
rowNumbercheckedThe row that is edited
valueObjectcheckedcheckedThe value of the currently editing cell

Methods

NameDescription
cancelEditEnds the current editing of the cell without raising a change event
commitEditEnds the current editing of the cell but fires of a change event
createAttachedComponentCreates 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.
getCanEditWhether we can edit the cell at the given position
getEditOptionsThis 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. If userValue has been set for the object (option), then that is the value that will be returned when getValue() is called.
getEditTypeReturns the type of editing we want to use for the cell at the given position
setEditCellSets the cell to edit. In order to start editing the cell is necessary to call the startEditing method of the owner.

Events

NameTypeBubblesDescripton
beforehideBiEventThis happens before the editing component is hidden. If the default action is prevented here the component is not removed from the tree view
beforeshowBiEventThis event is dispatched before the editing component is added to the BiTreeView component
changeBiEventThis event is fired when the value of the currently editing cell has changed.
hideBiEventWhen the editing component has been removed/hidden.

Static Methods

None.

Static Fields

NameTypeDescripton
EDIT_TYPE_BOOLEANNumberConstant for editing a Boolean value. This shows a check-box for editing the value as the attached component
EDIT_TYPE_ENUMNumberConstant for selection one value out of a few options. This type shows a BiComboBox as the attached component
EDIT_TYPE_NUMBERNumberConstant for editing a number value. This shows a spinner for editing the value as the attached component
EDIT_TYPE_STRINGNumberConstant for editing a string value. This type shows a simple BiTextField as the attached component

Remarks

None.

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 ( nEditType )

Parameters

NameTypeOptionalDefaultDescripton
nEditTypeNumberThe 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

NameTypeOptionalDefaultDescripton
xNumberThe column of the cell we want to edit
yNumberThe 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. If userValue has been set for the object (option), then that is the value that will be returned when getValue() is called.

Syntax

object.getEditOptions ( x,y )

Parameters

NameTypeOptionalDefaultDescripton
xNumberThe column of the editing cell
yNumberThe 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

NameTypeOptionalDefaultDescripton
xNumberThe column of the cell we want to edit
yNumberThe row of the cell we want to edit

Return Type

Number

setEditCell

Sets the cell to edit. In order to start editing the cell is necessary to call the startEditing method of the owner.

Syntax

object.setEditCell ( x,y )

Parameters

NameTypeOptionalDefaultDescripton
xNumberThe column that the cell is at
yNumberThe row that the cell is at

Return Type

void