Changing style sheets and images
TreeGrid v5.5
All TreeGrid style definitions are in one .css file, by default in Grid.css. You have to include the style sheet into HTML header.
To change TreeGrid styles is better to update existing .css files than to create new one, because there are many restrictions to preserve grid layout compact.
You can change individual styles in the .css file, but you must preserve all style names. You can also add new styles to use them in TreeGrid row Class attribute, ClassOuter, ClassInner cell attributes or in event OnGetClass.
To change CSS style for individual cell you can use its XML attributes Class, ClassInner, ClassOuter and ClassEdit. Dynamically you can change CSS class in API event OnGetClass.
In Grid.css all style names starts with letter “G”. This is default prefix. To use more style sheets you need to use another prefix in other sheets and set it in input XML data to <Style Prefix=’G’/> attribute. In predefined style sheets are these prefixes: GridModern “GM”, GridLight “GL”, GridOffice “GO”.
By CSS styles you can define all visual properties except background color for cells. For setting cell/row background color use tag <Colors> in input XML. Or use cell or row attribute Color.
All TreeGrid images are in two files, one with all row images and one with toolbar images. By default these files are Grid.gif and Toolbar.gif.
You can change these files, but you must preserve image position and order. If you change sizes of images, you must update settings in XML input data, tag <Img>.
Some styles use other image files for their backgrounds. These backgrounds are defined directly in .css file.
There also two cursor files for dragging. DragOne.cur and DragMore.cur. These files are not required.
! Don't use margin properties, except is explicitly permitted.
! Don’t set border or padding to strings (like “medium”), use always value in pixels (like “1px”).
! Don't change extent properties (border, width, height) at runtime (in events).
TreeGrid contains many <table> tags, so remember difference in inheriting styles in Strict (inherits to tables) and Quirks (does not inherit) modes.
Here you can change border and padding of whole grid section. The border and padding set with relation to Special rows settings and Toolbar.
! Sections on vertical must have the same width
! Sections on horizontal must have the same height
.GHeadLeft Header + fixed head rows, row panels + left fixed columns
.GHeadMid Header + fixed head rows, variable columns
.GHeadRight Header + fixed head rows, right fixed columns
.GBodyLeft Variable rows, row panels + left fixed columns
.GBodyMid Variable rows, variable columns
.GBodyRight Variable rows, right fixed columns
.GFootLeft Fixed foot rows, row panels + left fixed columns
.GFootMid Fixed foot rows, variable columns
.GFootRight Fixed foot rows, right fixed columns
.GVScroll Vertical scrollbar, you can also its background
.GHScroll Horizontal scrollbar, you can also its background
.GXScroll Right bottom cell between scrollbars, here you can set its background. ! its border attribute is ignored now.
Here you can set margin, border, padding and background of special solid rows. The margin, border and padding set with relation to Sections settings and Toolbar.
GSpace, GSearch, GGroup, GPager Given special space row.
GFilter Filter row. You must not set its border or margin.
GFillRow Space row with RelHeight=’1’ to fill remaining space of main tag, used also for row created by ConstHeight attribute.
GFillUserRow Fixed User row with RelHeight=’1’ to fill remaining space of main tag. You must not set its border or margin.
Here you can set border, padding, background, vertical alignment and wrapping of cells.
Here you control whole cells, including tree icons, right buttons, sorting icons in header and so on.
Remember background colors are automatically changed by cell states, you should set background only for header cell or panel.
! All cells must have the same border width and padding
.GHeader Header cell, contains column captions
.GHeaderNoSort Header cell when sorting is not permitted or by clicking to sort icon only.
.GHeaderHover Header cell under mouse cursor
.GHeaderNoSortHover Header cell when sorting is not permitted or by clicking to sort icon only, under mouse cursor.
.GHeaderFocus Header cell when moving
.GHeaderGroup Header cell displayed on group row, when used custom grouping area.
.GHeaderGroupFocus Header cell on group row being dragged outside.
.GHeaderGroupDelete Header cell on group row to be removed from the row.
.GHeaderMulti Odd multiline header cell
.GHeaderMultiHover Odd multi-line header cell under mouse cursor.
.GHeaderMultiEven Even multiline header cell
.GHeaderMultiEvenHover Even multi-line header cell under mouse cursor.
.GPanelTop Top row panel left to header
.GPanelTopHover Top row panel under cursor
.GPanel Variable row panel on the left
.GPanelHover Variable row panel under mouse cursor
.GFixedPanel Fixed row panel on the left
.GFixedPanelHover Fixed row panel under mouse cursor
.GFilterPanel Filter row panel on the left
.GFilterPanelHover Filter row panel under mouse cursor
.GSpacePanel Space row panel on the left
.GSpacePanelHover Space row panel under mouse cursor
.GCell All editable ells in variable rows
.GCellNE All non editable cells in variable rows
.GFixedCell All editable cells in fixed rows
.GFixedCellNE All non editable cells in fixed rows
.GFilterCell All editable cells in filter row
.GFilterCellNE All non editable cells in filter row
.GSpaceCell All editable cells in space rows except .GSpaceSelectCell and .GSpaceCheckboxCell
.GSpaceCellNE All non editable cells space rows
.GSpaceCheckboxCell All editable cells of type Bool in space rows
.GSpaceSelectCell All cells with Button type Defaults in space rows
.GSpaceSelect The text part of cell with Button type Defaults in space rows.
.GRightButton The button in cell on right side
.GFilterButton The button in filter row to change operator and in menu
.GTreeIcon Any icon (line, expand/collapse button) displayed in tree
.GCellSpaceButton Cell with standard button (it is parent <div> tag of <button>)
Here you can set font, text color, and other text attributes of cell content.
Here you control just inner content of the cell without any tree icons, right buttons or sorting icons in header. Or you control these buttons and icons separately.
Here you can set padding, border or even margin of input controls like <input>. Take care about these settings; they are optimized for all browsers.
.GHeadText Column caption
.GHeadSort Sort icon
.GGroupText Column caption on grouping row.
.GText Text cell (Text, Pass, Enum), not edited
.GLines Text cell on more lines (Lines)
.GNumber Number cell (Int, Float, Date), non edited
.GTextB, .GNumberB Highlighted cells, not used in grid, for custom events only
.GTextM, .GNumberM More highlighted cells, not used in grid, for custom events only
.GIText Edited text cell, with <INPUT type='text'>
.GINumber Edited number cell, with <INPUT type='text'>
.GTextArea Edited or nonedited cell with more rows (tag <TEXTAREA>)
.GSelect Edited enum cell, with <SELECT>
.GHtml Non editable cell of type “Html”
.GRadio Cell type “Radio”
.GButton Button right to the cell value
.GButtonImg Image button right to the cell value
.GButtonSpace Standard button cell (Button), settings of <button> tag
.GButtonSpaceChecked Standard button cell (Button), with value of 1 - marked button.
.GGroupCustom Text in DropCols type cell (like “To group by, drag column caption here...”)
Here you can set all CSS attributes of grid control panel (by default placed on bottom).
.GToolbar Main tag setting, you can set its border, padding and background attributes.
The border and padding set with relation to Sections settings and Special rows settings.
.GToolbarCell Every cell on toolbar (Toolbar is Space row).
.GToolbarImg Every button on control panel. It is setting also for cell type Button with Icon attribute set.
Here you can set border, padding, margin, background and cursor attributes.
.GToolbarImgHover Image/link button under mouse cursor
.GToolbarImgChecked Image/link button cell (Button) with Icon attribute set, with value of 1 - marked button.
.GToolbarImgHoverChecked Checked image button under mouse cursor
.GToolbarFormula Style of toolbar Formula, for backward compatibility.
Here you can set all CSS attributes for menu dialogs – main configuration menu and columns visibility menu.
.GCfgMenu Main menu tag, you can set its border, padding, margin or background.
.GCfgMenuHeader Header and caption of main menu.
.GCfgMenuSeparator Separator between menu sections.
.GCfgMenuItem One menu item and also caption, you can set its font, color and other text attributes and also background and padding.
.GCfgMenuHover One menu item under mouse cursor, you can set its font, color and other text attributes and also background and padding.
.GCfgMenuButton Button (OK,Cancel) on menu, the <button> tag.
Here you can set all CSS attributes for all popup menus, like Defaults menu, Filter menu, Cell menu or menu displayed by ShowMenu API method.
.GMenu Main menu tag, you can set its border, padding, margin or background.
.GMenuItem One menu row, you can set its font, color and other text attributes and also background and padding.
.GMenuHover One menu row under mouse cursor, you can set its font, color and other text attributes and also background and padding.
Here you can set all CSS attributes for date picker popup dialog.
.GPickTag Main tag of date picker, <div> tag
.GPickBorder Left and right side border, <td> tag
.GPickHeader Top area with caption and close icon, <tr> tag
.GPickHeadText Dialog caption “Please select date”, <td> tag
.GPickClose Close button
.GPickDate The second row of dialog with month and year to select, <tr> tag
.GPickBL Left button cell to change month and year
.GBickBR Right button cell to change month and year
.GPickB The left and right button itself, <button> tag
.GPickMonth <Select> month
.GPickYead <Select> year
.GPickRow Every row with date numbers or row with day captions, <tr> tag
.GPickCell Every cell with date numbers or row with day captions, <td> tag
.GPickHover Every selectable date number under mouse cursor
.GPickWDN Weekday names
.GPickWD Workdays
.GPickSa Saturdays
.GPickSu Sundays
.GPickSel Selected day
.GPickNow Today
.GPickWDNE, .GPickSaNE, .GPickSuNE, .GPickSelNE, .GPickNowNE Not editable cells.
.GPickTimeCell The last row with displayed time, visible only if the cell has time part in its EditFormat
.GPickTime <input> with time
Here you can set all CSS attributes for main vertical pager, displayed on the right, when paging is used.
.GPagerBody Whole body of pager
.GPagerHeader Top header of pager
.GPagerCaption Header's text
.GPagerItem One item on pager body
.GPagerHover Item under mouse cursor
.GPagerCursor Selected page(s)
.GPagerSort1, .GPagerSort2, .GPagerSort3 Item names according to sorted columns, 1 is most important, 3 least
.GPagerSortS Item name separator
Here you can set all CSS attribute for horizontal pager content.
The pager is displayed as Space row and uses class GPager for the pager row.
GSimplePager One link on the pager, you can set its border, margin, padding, background and also text attributes like font or color.
You can also set the GSimplePager:visited and GSimplePager:hover classes.
.GMessage Informational or error message box (like “Rendering...” or “Sorting...”). You can sets any its CSS attribute except size and position.
The exact GMessage class (with G prefix) is always used for messages displayed before Defaults.xml is loaded.
.GPageMessage Message box when loading/rendering the page (displayed inside empty page). You can sets any its CSS attribute except size and position.
.GPage One page body if showing all pages, you can set its border, padding or background.
.GPageOne One page body if paging is not used, you can set its border, padding or background.
.GChildPage Area with children of row, you can set its border, padding or background.
.GTable Main tag of whole table. You can set its border or padding. It is for <table> tag, so padding is spacing between sections.
To set spacing between cells, set <Cfg CellSpacing>.
This image file can be changed in input XML data <Img Grid=””>. By default this file is named Grid.gif and is located in directory with .css file.
This image file contains all icons displayed in grid.
The file contains 7 rows of images. The first three rows are 128 pixels high and the next four rows are 32 pixels height. You cannot change the height of these rows.
Remember, if you change width of any type of images by some <Img> attribute, like Tree, Line, Filter, … You must resize and move all images on the appropriate row.
Tree images
The first three high rows contain images for building tree. To speed up rendering the first two rows contain all combinations of tree icons.
These two rows have images:
000L010L001L011L
100L110L101L111L
Where 0 and 1 are images of line (0 = empty, 1 = line). These images are all 21 pixels wide by default, this value can be changed by <Img Line=””> attribute.
L are images for end of line. These images are 26 pixels wide by default, this value can be changed by <Img Tree=””> attribute.
The third high row contains the rest of tree images like L image. These images are 26 pixels wide by default, this value can be changed by <Img Tree=””> attribute.
When displayed, the tree images are displayed as high as the row. If row if higher then 128 pixels, the tree image is repeated without first 32 pixels (vertically).
Row images
The last four rows contain other row images. The rows are 32 pixels high, but height of all these images is 17 pixels by default and can be changed by <Img Height=”” SpaceHeight=””> attributes.
In the fourth row are panel images. All these images must have the same width, defined in <Img Panel=””>. By default in Grid.gif have images width 13 pixels.
These images are in the order: MSDC MSDC MSDC MSDC MSDC MSDC MDC MDC MC
where S is select (unselected), S is unselect (selected), S is not selectable, D is delete, D cannot be deleted, M is move, C is copy.
Cannot move and cannot copy icons are always empty images and cannot be changed.
In the fifth row are sorting images. All these images must have the same width, defined in <Img Sort=””>. By default in Grid.gif have images height 14 pixels.
In the fifth row on position 160px are icons for Space panel – GroupOn, GroupOff, no grouping, SearchOn, SearchOff, no sorting.
Width of icons is defined by <Img SpacePanel=””>
In the fifth row on position 300px continue panel images, see them above. The order is MSC MSC MSC FF. Where F is Filter On and F is Filter off.
In the sixth row are filter images. All these images must have the same width, defined in <Img Filter=””>. By default in Grid.gif have images height 17 pixels.
In the sixth row on position 300px are icons for Space row content – Defaults, Bool false, Bool true.
Width of icons is defined by <Img SpaceRow=””>
In the seventh row are row content images (unchecked, checked, date picker, radio, checked radio, button defaults). All these images must have the same width, defined in <Img Row=””>. By default in Grid.gif have images height 17 pixels.
In the seventh row on position 128px are tree images for use when tree lines are switched off by <Cfg NoTreeLines=’1’/>. These images are 26 pixels wide by default, this value can be changed by <Img Tree=””> attribute.
This image file can be changed in input XML data <Img Toolbar=””>. By default this file is named Toolbar.gif and is located in directory with .css file.
All images are in one row and must have the same width and height. The size is defined in input XML data <Img ToolbarHeight=”” ToolbarWidth=””> attribute. By default in Toolbar.gif have images width 16 and height 16 pixels.
The images are in this order: Save, Reload, Repaint pages, Add, Add child, Sorting enabled, Sorting disabled, Calculations enabled, Calculations disabled, Expand all, Collapse all, Show configuration, Show help.
DragOne.cur, DragMore.cur
These mouse cursor files can be changed in input XML data <Img DragOne=”” DragMore=””>. By default these files are named DragOne.cur and DragMore.cur and are located in directory with .css file.
DragOne.cur is displayed when dragging one row or column.
DragMore.cur is displayed when dragging more rows.
Updates
4.1
Added some new styles and information about prefix
4.2
Added GFillRow style attribute
4.4
Updated Grid.gif section
5.0
Rewritten Style sheet section
5.5
Updated Grid.gif, row images – updated Panel images and added Space row panel and content images
Added many new styles to style sheet
5.5.5
Added .GChildPage class