TreeGrid v6.0

Column position and moving

TreeGrid documentation index

 

There are three column sections in grid – Left (0), Mid (1) and Right (2). In API methods are the sections identified by their indexes (0,1,2).

The Left (0) and Right (2) sections are fixed sections and always show all its content and no horizontal scrollbars.

The Mid (1) section is positioned between Left and Right section and its content can be scrolled horizontally.

 

Column are placed into its section in input XML, in <LeftCols> (Left), <Cols> (Mid), <RightCols> (Right).

Column position inside section is set by the position of <C> tag inside its XML section <LeftCols>, <Cols>, <RightCols>.

The column position is saved to cookies, so the mentioned position is used only first time. To not save the position to cookies set <Cfg ColsPosLap=’1’/> or <ColsLap=’1’/>.

 

The columns can be moved by a user by mouse dragging, inside or among sections, controlled by <C CanMove/> attribute.

Or can be moved by API method MoveCol.

 

<C>                 int        CanMove           [2/0]                                                                                                   chg 6.3       .

If and how column can be moved by a user - dragged by mouse.

0 – no

1 – only inside its section (Left, Mid, Right)

2 – inside and also between sections – user can freeze variable columns and vice versa.

For spanned columns see also Group attribute.

By default it is 2 for all columns except Panel that has 0.

When column has CanMove=’0’, since 6.3 can be moved columns right to this column in left section, left to it in right section and both side in variable columns.

 

<C>                 int        Group        [0]                                                                                                                              .

Controls moving column, it is useful especially if there are some cells spanned to or from other columns.

If set to > 0, it is the group the column belongs to. Create groups that contain the spanned cells. The groups must be continuous.

The columns can be moved only inside its group and any other column cannot be moved into the group from outside.

The first (left) column in the group cannot be moved within group and also must stay the first.

The whole group can be moved by dragging the first left column to another location.

This attribute has no relation with grouping rows.

 

<Cfg>               bool      ColMoving        [1]                                                                                                                  .

If columns can be moved by a user -  dragged by mouse. Use column CanMove attribute to specify if and how can be individual columns moved.

 

<Cfg>              bool      ColsPosLap                                                                                                                          .

Suppresses loading column positions from cookies and always use their positions in input XML.

 

<Cfg>              bool      ColsLap                                                                                                                                    .

Suppresses loading column positions, visibility and widths from cookies and always use the settings in input XML.

 

<Cfg>              bool      ShowDrag         [1]        Saved to cookies, to not load it, set ShowDragLap=’1’                        .

If shows dragged object under mouse cursor. The dragged row(s) or moved column(s).

It can be changed by a user in configuration menu

 

<Actions>                    ColMove             Mouse dragging action, only for OnDrag... event                                              .

Starts moving column by mouse.

By default is the action attached to event OnDragHeader (dragging header cell).

 

API event         void      OnColMove      (TGrid grid, string col)                                                                                      .

Called after column is moved to another position by a user (not by API).

 

API method     void      MoveCol (string col, string tocol, bool right, bool noshow = 0) or (string col, int sec, bool last, bool noshow = 0)                     upd 6.0 .

Moves column to new position. If noshow is set, does not display changes and needs to call Render.

a) Moves column col in front of column tocol (or after tocol if right is 1).

b) Moves column col to section sec (0 – left, 1 – mid, 2 – right), to beginning (or to the end if last is 1). Use when destination section is empty.

Remember, moving column is slow process, much slower than moving row, all the column cells must be moved one by one.

Remember, this function can re-render the whole grid in some cases (when it leads to hide or show the whole column section)

 

API method     void      ChangeColsPositions    (string[] leftcols, string[] cols, string[] rightcols)                         .

Changes positions of all columns in grid and splits them to sections.

All three arguments are Arrays of column names sorted according their positions in given section.

You can call this method instead of MoveCol if you want to move more columns and after change call Render.

Or you can call this method on grid start before render (e.g. in OnRenderStart event) to change the column positions.

All column names in grid must be given!

It does not show changes, you must re-render grid (by Render method) otherwise is the layout is broken!

It does not save changes to cookies.

It does not update horizontally spanned cells!

 

API TCol var.   int        Sec  read only                                                                                                                                .

Column section - 0 Left, 1 Mid, 2 Right

 

API TCol var.   int        Pos  read only                                                                                                                               .

Column position inside its section, from 0. All columns including hidden.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

.