Class zwt.ui.table.TableSelector
Extends
zwt.Object.
A table selector defines the selection behavior in a table. Basically, a user select data in a table by selecting a cell using the keyboard or the mouse. The table relies on a selector to update the selection model based on these user actions.
It also provides a bridge between the view and the model. It actually converts user interaction on the elements in the view to the cells to select and/or deselect in the model.
This default implementation supports standard single and multiple cells selection with standard meta keys behavior. You may want to provide your own implementation to select cells differently.
Defined in: TableSelector.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Construct a table selector.
|
Field Attributes | Field Name and Description |
---|---|
<static> |
zwt.ui.table.TableSelector.MULTIPLE_SELECTION
Indicate a multiple selection mode.
|
<static> |
zwt.ui.table.TableSelector.SINGLE_SELECTION
Indicate a single selection mode.
|
Method Attributes | Method Name and Description |
---|---|
Return the current base column index.
|
|
Return the current base row index.
|
|
Return the selection mode of the selector.
|
|
getTable()
Return the table associated to the selector.
|
|
select(int_rowIndex, int_colIndex, boolean_shift, boolean_ctrl)
Update the selection model attached to a table based on the specified row index, column index and set of meta-keys the user may have used.
|
|
setSelectionMode(int_mode)
Set the selection mode of the selector.
|
The base index is used as the origin in a group selection (with Shift meta-key).
- Returns:
- the base column index
The base index is used as the origin in a group selection (with Shift meta-key).
- Returns:
- the base row index
In a zwt.ui.table.TableSelector.SINGLE_SELECTION mode, the selector can only select one cell at time which is the default behavior.
In a zwt.ui.table.TableSelector.MULTI_SELECTION mode, the selector can select multiple cells at time, allowing grouping or non contiguous selections.
- Returns:
- The selection mode
- Returns:
- The table
This method should notify the selection model with the cells to select and/or deselect.
- Parameters:
- {Integer} int_rowIndex
- The index of the row in the view
- {Integer} int_colIndex
- The index of the column in the view
- {Boolean} boolean_shift
- true if the Shift meta is active
- {Boolean} boolean_ctrl
- true if the Ctrl meta is active
- Parameters:
- {Integer} int_mode
- The selection mode to set (one of zwt.ui.table.TableSelector.SINGLE_SELECTION or zwt.ui.table.TableSelector.MULTIPLE_SELECTION)