The FocusModel class is an implementation of the FocusModelIf interface.
It provides core functionality to manage focus inside a data grid or spreadsheet-like structure.
The focus can be set to a specific cell or to the whole row.
This class also maintains a list of EventFocusChangedListenerIf instances and notifies them
whenever there is a change in focus.
selectionType: FocusType — Specifies the type of selection that is currently in focus. It could be either a specific cell or the whole row. Defaults to "none".
rowIndex: number — Specifies the row index of the cell that is currently in focus.
columnIndex: number — Specifies the column index of the cell that is currently in focus.
listenerArr: EventFocusChangedListenerIf[] — An array of EventFocusChangedListenerIf instances. These instances will be triggered when the focus changes.
changed — A boolean flag to check if the focus has changed since the last trigger.
The
FocusModelclass is an implementation of theFocusModelIfinterface. It provides core functionality to manage focus inside a data grid or spreadsheet-like structure. The focus can be set to a specific cell or to the whole row. This class also maintains a list ofEventFocusChangedListenerIfinstances and notifies them whenever there is a change in focus.Instance Properties:
selectionType: FocusType— Specifies the type of selection that is currently in focus. It could be either a specific cell or the whole row. Defaults to "none".rowIndex: number— Specifies the row index of the cell that is currently in focus.columnIndex: number— Specifies the column index of the cell that is currently in focus.listenerArr: EventFocusChangedListenerIf[]— An array ofEventFocusChangedListenerIfinstances. These instances will be triggered when the focus changes.changed— A boolean flag to check if the focus has changed since the last trigger.Instance Methods:
getEventFocusChangedListeners— Returns an array ofEventFocusChangedListenerIfinstances.addEventFocusChangedListener(listener: EventFocusChangedListenerIf): void— Adds a listener to the listeners array, if it's not already present.removeEventFocusChangedListener(listener: EventFocusChangedListenerIf): void— Removes a listener from the listeners array.clear: void — Clears the current focus.setFocus(rowIndex: number, columnIndex: number): void— Sets focus on a given cell.hasChanged(): boolean— Checks if the focus has changed.clearChanged: void — Clears thechangedflag.hasFocus(rowIndex: number, columnIndex: number): boolean— Checks if a given cell is in focus.getFocus(): [number, number]— Returns the row and column indexes of the cell that's currently in focus.Usage Example
See
Implements