Wednesday, April 29th, 2009p>Mark Pilgrim has nicely discussed the new HTML 5 datagrid element on his latest This Week in HTML 5:
datagriddata model, data is structured as a set of rows representing a tree, each row being split into a number of columns. The columns are always present in the data model, although individual columns might be hidden in the presentation.
Each row can have child rows. Child rows may be hidden or shown, by closing or opening (respectively) the parent row.
Rows are referred to by the path along the tree that one would take to reach the row, using zero-based indices. Thus, the first row of a list is row “0″, the second row is row “1″; the first child row of the first row is row “0,0″, the second child row of the first row is row “0,1″; the fourth child of the seventh child of the third child of the tenth row is “9,2,6,3″, etc.
The chains of numbers that give a row’s path, or identifier, are represented by arrays of positions, represented in IDL by the
The root of the tree is represented by an empty array.
Each column has a string that is used to identify it in the API, a label that is shown to users interacting with the column, a type, and optionally an icon.
The possible types are as follows:
Text with a check box.
A list of values that the user can switch between.
A progress bar.
A canvas onto which arbitrary content can be drawn.
Each column can be flagged as sortable, in which case the user will be able to sort the view using that column.
Columns are not necessarily visible. A column can be created invisible by default. The user can select which columns are to be shown.
When no columns have been added to the
datagrid, a column with no name, whose identifier is the empty string, whose type is
text, and which is not sortable, is implied. This column is removed if any explicit columns are declared.
Each cell uses the type given for its column, so all cells in a column present the same type of information.
Posted by Dion Almaer at 4:26 am