3. Row and column manipulation
Adding, copying, deleting, moving, hiding individual or groups of columns and rows
Rows
-
Rows can be selected or unselected by clicking to or dragging left Panel Select button or by pressing Space.
It is default behavior set in Defaults.xml by <Cfg Selecting='1'.
All rows can be selected or unselected by clicking to Header Panel SelectAll button. It is default behavior.
Here the SelectAll button is a switch showing if all rows are selected. It is set by <Cfg> SelectAllType='31'.
-
Rows can be resized by mouse dragging its edge in Index column. It is set by <C> Resizing='1' in the Index column definition.
-
Rows can be moved by dragging the Index column.
It is default behavior set in Defaults.xml by <Cfg> Dragging='1' Dropping='1'.
Dragging by other columns is overridden by focusing cells by FocusRect.
If dragged selected row, all selected rows are moved to the destination.
To show drag cursor in plain grid without tree define MainCol and restrict other tree features like
<Cfg MainCol="Index" SpannedTree="1" NoTreeLines="1"/> <Def> <D Name="R" CDef="" AcceptDef=""/> </Def> <Toolbar AddChild="0" Outdent="0" Indent="0" ExpandAll="0" CollapseAll="0"/>
-
Rows can be copied by dragging the Index column with Ctrl.
It is default behavior set in Defaults.xml by <Cfg> Dragging='1' Dropping='1' Adding='1' Copying='1'.
If dragged selected row, all selected rows are copied to the destination.
-
Rows can be copied or added by clicking to left Panel Copy button. It is shown by <Panel Copy='1'/>.
The Copy menu permits copying or adding one row, all selected or all focused rows.
Selected or focused rows can be copied or added also by clicking to toolbar Add button.
-
Rows can be deleted or undeleted by clicking to left Panel Delete button or by pressing Del.
Selected rows can be deleted or undeleted by clicking to Index Panel DeleteAll button.
-
In this sample rows can be hidden or shown by clicking to left Panel Delete button, its Menu contains items also for hiding / showing rows.
In this sample also any fixed row can be hidden from right click popup menu by custom action, see the Menu below.
Columns
-
Columns can be selected or unselected by clicking to or dragging top Panel Select button.
It is set by <Cfg> SelectingCols='1'. The top panel is shown by placing <Panel/> tag in <Head> section.
All columns can be selected or unselected by clicking to Index Panel SelectAll button. It is set by adding ColSelectAll to <Panel> row, here as <Panel Index="ColSelectAll,ColDeleteAll,ColCopyAll"/>
Here the SelectAll button is a switch showing if all columns are selected. It is set by <Cfg> SelectAllType='31'.
-
Columns can be resized by mouse dragging its edge in Header row. It is default behavior set in Defaults.xml by <Cfg> ColResizing='1'.
-
Columns can be moved by dragging the Header row.
It is default behavior set in Defaults.xml by <Cfg> ColMoving='1'.
If dragged selected column, all selected columns are moved to the destination.
-
Columns can be copied by dragging the Header row with Ctrl. It is set by <Cfg> ColAdding='1' ColCopying='1'.
If dragged selected column, all selected columns are copied to the destination.
-
Columns can be copied or added by clicking to left Panel Copy button.
It is set by <Cfg> ColAdding='1' ColCopying='1'. The top panel is shown by placing <Panel/> tag in <Head> section.
The Copy menu permits copying or adding one column, all selected or all focused columns.
Selected or focused columns can be copied or added also by clicking to toolbar AddCol button.
-
Columns can be deleted or undeleted by clicking to top Panel Delete button.
It is set by <Cfg> ColDeleting='1'. The top panel is shown by placing <Panel/> tag in <Head> section.
Selected columns can be deleted or undeleted by clicking to Header Panel DeleteAll button.
It is set by adding ColDeleteAll to <Panel> row, here as <Panel Index="ColSelectAll,ColDeleteAll,ColCopyAll"/>
-
Columns can be hidden or shown from columns menu shown on click to toolbar Columns button.
In this sample columns can be hidden or shown also by clicking to top Panel Delete button, its Menu contains items also for hiding / showing columns.
In this sample also any fixed column can be hidden from right click popup menu by custom action, see the Menu below.
Menu
-
The right click popup menu is defined by <Cfg> / <C> / <I> / cell
Menu
attribute.
In this sample the Menu is defined for all grid items in <Cfg Menu='...'/>.
The Menu can contain items for grid standard action or any custom API action. The Menu format can be first character separated array or complex JSON.
This example uses complex JSON format with submenus to control rows and columns.
-
The menu hides options not available for given row or column by <Cfg> HideMenuUnused='1'.
-
This example defines custom actions for showing and hiding particular fixed rows and columns.
These custom actions are defined in JavaScript in HTML file. These custom items are also used in the Menu.
-
This example modifies the row and column Panel Delete and DeleteAll button to show popup menu with delete/undelete and hide/show option.
It is set by <Panel OnClickPanelDelete="ShowMenu OR ShowNoMenu" PanelDeleteMenu="..." OnClickPanelDeleteAll="ShowMenu OR ShowNoMenu" PanelDeleteAllMenu="..."/>
Other features
-
Standard number row index shown in new left column named "Index", for all rows except deleted. It is set by <Cfg RowIndex="Index" RowIndexType="6"/>.
Standard character column index shown in main header, for all columns except deleted. It is set by <Cfg ColIndex="Header" ColIndexType="6" ColIndexChars="ABCDEFGHIJKLMNOPQRSTUVWXYZ"/>
-
Row ids are shown in the right column. Compare them to row Index when rows are moved, deleted or copied. The row id is generated automatically from 1 and with "R" prefix set by <Cfg AutoIdPrefix="R"/>.
Column names are shown in bottom row. Compare them to column Index when columns are moved, deleted or copied. The column name is generated from "A" in the same way as index.
-
Automatic adding new rows on scroll to bottom and clearing them when not shown. Set by
<Cfg Paging="2" AutoPages="1" PageLength="10" MaxPages="3" RemoveUnusedFixed="0" RemoveAutoPages="1"/> <Pager Visible="0"/>
Automatic adding new columns on scroll to right and clearing them when not shown. Set by <Cfg ColPaging="2" AutoColPages="1" ColPageLength="10" ColPageMin="0" MaxColPages="3" ColPagingFixed="0" RemoveAutoColPages="1"/>
-
Cell range can be focused by mouse dragging. It is set by <Cfg> FocusRect='5'.
Enter moves cursor down. It is set by <Cfg> EnterMode='1'.
All actions can be undone, including focus and scroll. It is set by <Cfg> Undo='79'.