BiTreeViewDataModel
This defines the interface that is needed for a data model for a BiTreeView.
This actually implements a dummy data model. Extend this class to create
more useful data models
This class extends
BiEventTarget
and therefore all methods and fields available for
BiEventTarget
are also available for
BiTreeViewDataModel
.
Constructor
new
BiTreeViewDataModel
(
)
Parameters
No parameters.
Properties
Methods
| Name | Description |
getCanSortColumn |
This returns whether the data model can be sorted by column |
getCellIsAnchor |
Returns whether the cell is acting as the anchor item in the selection |
getCellIsLead |
Returns whether the cell is acting as the lead item in the selection |
getCellSelected |
Returns whether the cell is selected |
getCellStyle |
This allows a custom CSS text to be applied to a cell. This allows more detailed control over the rendering of the cell. |
getCellText |
This should return the text (HTML string) to show for the cell at (x,y) |
getContextMenu |
This allows a context menu to be shown when the user invokes the context menu on the cell |
getDepth |
The depth of the current row. If the data model describes a tree structure the depth is used to indent the row |
getDropDataTypes |
Returns the supported data types for the cell. Return [] or
null if no drop is desired on the cll |
getExpanded |
Returns whether the row is expanded |
getHasChildren |
Returns whether the row has any children |
getHasIcon |
Returns whether the cell should display an icon. If this is the case the actual image URI is returned using getIcon |
getHeaderCellStyle |
This allows a custom CSS text to be applied to a header cell. This allows more detailed control over the rendering of the header cell. |
getHeaderCellText |
This should return the text (HTML string) to show for the header cell at x |
getIcon |
Returns the path to the image to show on the cell. This is only called for cells that should have an icon accordingly to getHasIcon |
getIconStyle |
Use this to specify some custom CSS to use for the icon image. |
getParent |
Returns the row index for the parent. If this represents a flat structure and the the row has no parent then this should return -1 |
getRowHeaderCellStyle |
This allows a custom CSS text to be applied to a row header cell. This allows more detailed control over the rendering of the row header cell. |
getRowHeaderCellText |
This should return the text (HTML string) to show for the row header cell at y |
getRowIsAnchor |
Returns whether the row is acting as the anchor item in the selection |
getRowIsLead |
Returns whether the row is acting as the lead item in the selection |
getRowSelected |
Returns whether the row at y is selected |
getRowStyle |
This allows a custom CSS text to be applied to the row. This allows more detailed control over the rendering of the row. |
getShownChildrenCount |
Returns the number of shown descendants. If the data model represents a tree then this is the sum all descendants that are shown. |
getSortFunction |
Returns a function that compares two rows, looking at column x. The returned function should take 2 arguments and return a number depending on the relative order of the arguments. |
getToolTip |
This should return the tool tip to use for the cell |
setExpanded |
Sets whether the row is expanded. The data model is responsible for taking care of the expanded state. The data model should fire the following BiTreeViewDataModelEvent events, "beforeexpand", "beforecollapse", "expand" and "collapse" so that the BiTreeView can be updated |
sort |
This sorts the data model by column x. This should fire a BiTreeViewDataModelEvent called "datachanged" if the data changed (or was reordered) so that the BiTreeView is correctly redrawn |
Events
| Name | Type | Bubbles | Descripton |
datachanged |
|
This event is fired when the data has changed. |
Static Methods
None.
Static Fields
None.
Remarks
Method Details
getCanSortColumn
This returns whether the data model can be sorted by column
Syntax
object.getCanSortColumn
(
x
)
Parameters
| Name | Type | Optional | Default | Descripton |
x |
Number |
The column index |
Return Type
Boolean
getCellIsAnchor
Returns whether the cell is acting as the anchor item in the selection
Syntax
object.getCellIsAnchor ( x,y )
Parameters
| Name | Type | Optional | Default | Descripton |
x |
Number |
The column index for the cell | ||
y |
Number |
The row index for the cell |
Return Type
Boolean
getCellIsLead
Returns whether the cell is acting as the lead item in the selection
Syntax
object.getCellIsLead ( x,y )
Parameters
| Name | Type | Optional | Default | Descripton |
x |
Number |
The column index for the cell | ||
y |
Number |
The row index for the cell |
Return Type
Boolean
getCellSelected
Returns whether the cell is selected
Syntax
object.getCellSelected ( x,y )
Parameters
| Name | Type | Optional | Default | Descripton |
x |
Number |
The column index for the cell | ||
y |
Number |
The row index for the cell |
Return Type
Boolean
getCellStyle
This allows a custom CSS text to be applied to a cell. This allows more detailed control over the rendering of the cell.
Syntax
object.getCellStyle ( x,y )
Parameters
| Name | Type | Optional | Default | Descripton |
x |
Number |
The column index for the cell | ||
y |
Number |
The row index for the cell |
Return Type
String
getCellText
This should return the text (HTML string) to show for the cell at (x,y)
Syntax
object.getCellText ( x,y )
Parameters
| Name | Type | Optional | Default | Descripton |
x |
Number |
The column index for the cell | ||
y |
Number |
The row index for the cell |
Return Type
String
getContextMenu
This allows a context menu to be shown when the user invokes the context menu on the cell
Syntax
object.getContextMenu ( x,y )
Parameters
| Name | Type | Optional | Default | Descripton |
x |
Number |
The column index for the cell | ||
y |
Number |
The row index for the cell |
Return Type
getDepth
The depth of the current row. If the data model describes a tree structure the depth is used to indent the row
Syntax
object.getDepth
(
y
)
Parameters
| Name | Type | Optional | Default | Descripton |
y |
Number |
The index for the row |
Return Type
Number
getDropDataTypes
Returns the supported data types for the cell. Return [] or
null if no drop is desired on the cll
Syntax
object.getDropDataTypes ( x,y )
Parameters
| Name | Type | Optional | Default | Descripton |
x |
Number |
The column index for the cell | ||
y |
Number |
The row index for the cell |
Return Type
String[]
getExpanded
Returns whether the row is expanded
Syntax
object.getExpanded
(
y
)
Parameters
| Name | Type | Optional | Default | Descripton |
y |
Number |
The index for the row |
Return Type
Boolean
getHasChildren
Returns whether the row has any children
Syntax
object.getHasChildren
(
y
)
Parameters
| Name | Type | Optional | Default | Descripton |
y |
Number |
The index for the row |
Return Type
Boolean
getHasIcon
Returns whether the cell should display an icon. If this is the case the actual image URI is returned using getIcon
Syntax
object.getHasIcon ( x,y )
Parameters
| Name | Type | Optional | Default | Descripton |
x |
Number |
The column index for the cell | ||
y |
Number |
The row index for the cell |
Return Type
Boolean
getHeaderCellStyle
This allows a custom CSS text to be applied to a header cell. This allows more detailed control over the rendering of the header cell.
Syntax
object.getHeaderCellStyle
(
x
)
Parameters
| Name | Type | Optional | Default | Descripton |
x |
Number |
The column index for the header cell |
Return Type
String
getHeaderCellText
This should return the text (HTML string) to show for the header cell at x
Syntax
object.getHeaderCellText
(
x
)
Parameters
| Name | Type | Optional | Default | Descripton |
x |
Number |
The column index for the header cell |
Return Type
String
getIcon
Returns the path to the image to show on the cell. This is only called for cells that should have an icon accordingly to getHasIcon
Syntax
object.getIcon ( x,y )
Parameters
| Name | Type | Optional | Default | Descripton |
x |
Number |
The column index for the cell | ||
y |
Number |
The row index for the cell |
Return Type
String
getIconStyle
Use this to specify some custom CSS to use for the icon image.
Syntax
object.getIconStyle
(
y
)
Parameters
| Name | Type | Optional | Default | Descripton |
y |
Number |
The row index for the cell row containing the icon |
Return Type
String
getParent
Returns the row index for the parent. If this represents a flat structure and the the row has no parent then this should return -1
Syntax
object.getParent
(
y
)
Parameters
| Name | Type | Optional | Default | Descripton |
y |
Number |
The index for the row |
Return Type
Number
getRowHeaderCellStyle
This allows a custom CSS text to be applied to a row header cell. This allows more detailed control over the rendering of the row header cell.
Syntax
object.getRowHeaderCellStyle
(
y
)
Parameters
| Name | Type | Optional | Default | Descripton |
y |
Number |
The row index for the row header cell |
Return Type
String
getRowHeaderCellText
This should return the text (HTML string) to show for the row header cell at y
Syntax
object.getRowHeaderCellText
(
y
)
Parameters
| Name | Type | Optional | Default | Descripton |
y |
Number |
The row index for the row header cell |
Return Type
String
getRowIsAnchor
Returns whether the row is acting as the anchor item in the selection
Syntax
object.getRowIsAnchor
(
y
)
Parameters
| Name | Type | Optional | Default | Descripton |
y |
Number |
The index for the row |
Return Type
Boolean
getRowIsLead
Returns whether the row is acting as the lead item in the selection
Syntax
object.getRowIsLead
(
y
)
Parameters
| Name | Type | Optional | Default | Descripton |
y |
Number |
The index for the row |
Return Type
Boolean
getRowSelected
Returns whether the row at y is selected
Syntax
object.getRowSelected
(
y
)
Parameters
| Name | Type | Optional | Default | Descripton |
y |
Number |
The index for the row |
Return Type
Boolean
getRowStyle
This allows a custom CSS text to be applied to the row. This allows more detailed control over the rendering of the row.
Syntax
object.getRowStyle
(
y
)
Parameters
| Name | Type | Optional | Default | Descripton |
y |
Number |
The index for the row |
Return Type
String
getShownChildrenCount
Returns the number of shown descendants. If the data model represents a tree then this is the sum all descendants that are shown.
Syntax
object.getShownChildrenCount
(
y
)
Parameters
| Name | Type | Optional | Default | Descripton |
y |
Number |
The index for the row |
Return Type
Number
getSortFunction
Returns a function that compares two rows, looking at column x. The returned function should take 2 arguments and return a number depending on the relative order of the arguments.
Syntax
object.getSortFunction
(
x
)
Parameters
| Name | Type | Optional | Default | Descripton |
x |
Number |
The index of the column to compare the rows by |
Return Type
Function
getToolTip
This should return the tool tip to use for the cell
Syntax
object.getToolTip ( x,y )
Parameters
| Name | Type | Optional | Default | Descripton |
x |
Number |
The column index for the cell | ||
y |
Number |
The row index for the cell |
Return Type
setExpanded
Sets whether the row is expanded. The data model is responsible for taking care of the expanded state. The data model should fire the following BiTreeViewDataModelEvent events, "beforeexpand", "beforecollapse", "expand" and "collapse" so that the BiTreeView can be updated
Syntax
object.setExpanded ( y,b )
Parameters
| Name | Type | Optional | Default | Descripton |
y |
Number |
The index for the row | ||
b |
Boolean |
Whether the row is expanded or collapsed |
Return Type
void
sort
This sorts the data model by column x. This should fire a BiTreeViewDataModelEvent called "datachanged" if the data changed (or was reordered) so that the BiTreeView is correctly redrawn
Syntax
object.sort ( x [ ,bAscending ] )
Parameters
| Name | Type | Optional | Default | Descripton |
x |
Number |
The column index | ||
bAscending |
Boolean |
![]() |
Optional. Whether to sort ascending. If left out this toggles the current sort or sorts ascending if the column was not sorted before |
Return Type
void
