EJS TreeGrid documentation

Column visibility

TreeGrid documentation index

 

<C>                 bool      Visible      [1]        Saved to cookies, avoid it by <C VisibleLap=’1’/>                                            .

If the column is displayed in grid. Hidden column can be shown by a user from columns menu – depending on CanHide settings.

 

<Cfg>              bool      FastColumns  [1]                                                                                                       new 6.0.

If column hiding is done by setting its width to 0px. This action is faster than removing the cells and speeds up also showing the column.

The column is hidden correctly, but it is still present in HTML and is not removed either on re-render.

If the column is shown for first time (it was not displayed on first render, had set <C Visible=’0’/>), it is still slow.

 

<C>                 bool      Hidden [0]                                                                                                                       new 6.0.

Hidden=’1’ has sense only for Visible=’0’ and <Cfg FastColumns =’1’/>. On start or re-render this column will be rendered as hidden (width 0px).

It slows down rendering grid (the column is rendered) but speeds up showing column (it is just resized).

Set it to 1 if you expect the column will be shown later to speed it up.

 

<Space cell>    bool      Visible      [1]                                                                                                                              .

Space cells are independent on columns and can be shown or hidden by its cell attribute Visible.

If the space cell is not visible, it is not displayed at all (it is displayed with zero width).

Remember, this attribute can be also calculated (colVisibleFormula), so you can show or hide the space cells dynamically by the formula.

 

<I cell> int        Visible      [1]                                                                                                                              .

The normal (not Space) cells cannot be hidden completely, they will have always the width of its column.

If set Visible attribute to 0, the cell content is not displayed – the cell is shown empty, but its left / right button is visible.

If set Visible attribute to -1, the cell content is shown empty and also its left / right side button is not displayed.

 

API method     void      ShowCol             (string col)                                                                                                       upd 7.0.

Displays hidden column col in grid. If the column is already shown or does not exist, does nothing.

If the column is displayed for first time (it was hidden by XML <C Visible=’0’/> or is set <Cfg FastColumns=’0’/> the displaying of the column can be slow.

Since 7.0 it never does Render

 

API method     void      HideCol    (string col)                                                                                                       upd 7.0.

Hides visible column col. If the column is already hidden or does not exist, does nothing.

Since 7.0 it never does Render

 

API method     void      ChangeColsVisibility      (string[] Show, string[] Hide, bool prefer = 0)                 chg 7.0.

Changes visibility of given columns

Show – an array of column names to show

Hide – array of column names to hide

If column is present in both arrays, it will be shown for prefer = 0 or hidden for prefer = 1.

Since 7.0 it never require Render and always returns null.

 

<Actions>                    HideCol ...F      not assigned to any event                                                                               .

Hides actual or focused column.

 

<Actions>                    ShowColLeft ...F     not assigned to any event                                                                    .

Shows hidden column on left side from actual or focused cell

 

<Actions>                    ShowColRight ...F  not assigned to any event                                                                    .

Shows hidden column on right side from actual or focused cell

 

 

Columns visibility menu

This menu shows all permitted columns and let a user to check which columns will be visible.

This menu is by default shown on click to Toolbar cell Columns.

 

<Actions>                    ShowColumns          Attached to event OnClickButtonColumns                                          .

Shows menu to choose columns visibility

 

API method     void      ShowColumns          (string attribute, string caption, function func, TMenuItem[] options, string optionscaption)            new 6.0;upd 6.7.

Shows menu columns to let a user to check or uncheck columns.

caption is menu caption

attribute is name of column attribute, only columns with this attribute set will be listed (e.g CanHide, CanExport, CanPrint, ...)

If the user clicks to OK, it calls function func (string Cols[], object Names[], TMenu Menu) where Cols is array of checked columns, Names is name array of all columns as col:checked and Menu is the TMenu object.

options (new 6.7) – array of custom menu items to add to the end of the menu, it is possible to read the options changes in the function func.

optionscaption (new 6.7) – caption for the options shown as inactive caption in the menu

 

<Cfg>              int        MenuColumnsCount       [1]                                                                       renamed 6.0.

In how many columns the menu items will be displayed.

You can increase this value if the menu contains many items.

 

<Cfg>              bool      MenuColumnsSort            [0]                                                                               new 6.4.

If set, sorts all the columns in menu according to alphabet, independently on column section, case insensitive.

 

<C>                 int        CanHide [1]                                                                                                                  upd 8.0.

If column is displayed in Columns menu and can be hidden or displayed by user.

If set to 0, the column can be shown or hidden by API ShowCol / HideCol only. If the column has Visible=’0’ and is in Sort, it cannot be removed from the Sort.

If set to 1, the column can be shown or hidden also from configuration menu.

If set to 2, (since 8.0) the column can be shown or hidden by API ShowCol / HideCol only, but its sort behavior is normal. Use for child columns in tree.

You can also use CanHide=0 and Visible=0 to define always hidden column to store any custom data or to predefine sorting behavior – see <Cfg> SortCols.

 

<C>                 string    MenuName                                                                                                                             .

Html string displayed in Columns menu for this column. If not set, the column caption is displayed.

 

API event         bool      OnShowColumns   (TGrid grid, TMenu Menu)                                                        chg 6.0.

Called before menu for columns visibility is displayed, Menu is TreeGrid menu with all columns to display.

This event is called for every columns menu in grid (columns visibility, print, print pdf, export), you have to distinguish the menu according to the Menu items.

For example: Grids.OnShowColumns = function(G,M){ var I = M.Items[7].Items; I[I.length] = {Name:"XXX",Bool:1,Value:1}; }

Return true to not display the menu.

 

API event         bool      OnColumnsFinish (TGrid grid, TMenu Menu)                                                        new 9.1.

Called after the columns menu is closed to process custom menu items added in OnShowColumns API event.

This event is called for every columns menu in grid (columns visibility, print, print pdf, export), you have to distinguish the menu according to the Menu items.

For example: Grids.OnColumnsFinish = function(G,M){ var val = M.FindItem("XXX").Value; ... }

Return true to suppress the menu action

 

API event         bool      OnColumnsChanged      (TGrid grid, bool[] cols, int count)                                             .

Called when user presses OK button on columns menu. Before any updates in data or display.

cols is array of changed columns, with string index as column name and value as its new visibility

Return true to suppress changes

 

API event         void      OnAfterColumnsChanged      (TGrid grid)                                                      new 6.0.

Called after the visibility of all the columns has been changed