1. Basic grid
Basic grid with rows and columns
-
TreeGrid XML
- Every grid XML is defined inside
<Grid> ... <Grid>
tag. It is the only possible root tag in TreeGrid XML. See TreeGrid data formats
- The simplest empty grid can be created as <Grid> <Body> <B/> </Body> </Grid> - no columns and no rows (one empty page).
- TreeGrid base configuration is defined in
<Cfg/>
tag.
- Instead of XML can be used also JSON format, the tag and attribute names are the same as in XML format.
-
Rows
- TreeGrid is row based grid. Data are defined in rows. Many features like sort, group and filter are available for rows only, not for columns.
- The variable (body) rows are defined as
<I>
tags inside <Body><B> ... </B></Body>
tags.
- The fixed rows are defined as
<I>
tags inside <Head> ... </Head>
and <Foot> ... </Foot>
tags.
- For more information see Row types tutorial and Row basics documentation.
-
Columns
- The column defines name, position and width of all the cells in the column. The column optionally defines also cell attributes like Type, Format, CanEdit, etc. for all the cells in the column.
- The variable (middle) columns are defined by
<C>
tag inside <Cols> </Cols>
tags.
- The fixed columns are defined by
<C>
tag inside <LeftCols> </LeftCols>
and <RightCols> </RightCols>
tags.
- All three sections can be horizontally scrolled. By default only the middle section is scrollable, the left and right sections are fixed and always visible.
- Column can be moved (dragged) inside its section and also to another section. Column can be shown / hidden by users in columns menu (icon on toolbar).
- For more information see Columns and sections tutorial and Column basics documentation.
-
Cells
- TreeGrid data in cells are defined in rows, not in columns.
- The cell values are defined in <I> tag with attribute named as the column Name. For example <I Col1='10' Col2='20'/>.
- All cell attributes (except for column size and position like Width) can be defined for the whole column (in <C> tag, e.g. <C Name='Col1' Type='Int' Format='0.00'/>) or for individual cell (in <I> tag as column name+attribute name, e.g. <I Col1Type='Int' Col1Format='0.00' Col1='10'/>).
- For more information see Cells tutorials and Cell basics documentation.
-
Predefined items
There are four predefined items in grid: Header, Panel, Toolbar and Pager. All of them can be hidden, moved, redefined or created more times. All the default definitions are in file Grid/Defaults.xml.
Header
- fixed row <Header id='Header'/> as main header containing column captions. It is defined by <Header/>
tag placed directly in <Grid> tag.
Hide it by <Header Visible='0'/>. Define the column captions as normal row cells, like <Header Col1='Column 1'/>.
Change the main header position by placing into <Head> or <Foot> section as <Header id='Header'/>.
For more information see Rows tutorial.
Toolbar
- solid row <Toolbar id='Toolbar'/> as main toolbar containing basic TreeGrid buttons. It is defined by <Toolbar/>
tag placed directly in <Grid> tag.
Hide it by <Toolbar Visible='0'/>. Hide the default icons by setting their names to 0 like <Toolbar Print='0' ExpandAll='0'/>. Move the toolbar by setting its Space attribute.
Add new icons or other cells to the toolbar by redefining Cells attribute. Use default Cells definition in Grid/Defaults.xml and extend it (see next tutorial).
See Default toolbar documentation.
Panel
- left column <Panel Name='Panel' Type='Panel'/> as row left panel containing control buttons for individual rows. It is defined by <Panel/>
tag placed directly in <Grid> tag.
Hide it by <Panel Visible='0'/>. Hide / show the Panel button by setting their name to 0/1 like <Panel Select='0' Copy='1'/>.
Change the panel position by placing into <LeftCols>, <Cols> or <RightCols> tag as <C Name='Panel'/>.
See Panel Type documentation.
Pager
- side vertical pager <Pager Name='Pager'/> with root pages names. Shown only in paged grid (set <Cfg Paging/> attribute). It is defined by <Pager/>
tag placed directly in <Grid> tag.
Hide it by <Pager Visible='0'/>. Set its width by Width attribute. Move it to left by Left='1'.
See Pager documentation.