1. General information
1.1. Description of the control
DataGrid is a view table that displays database records retrieved by a query from a database, with the possibility search and filtering of records, and with the possibility of data exports and imports.
1.2. Create a new control
- A detailed description of creating new controls in the edit form is provided in the separate guide Creating edit form controls.
1.3. Edit or delete a control
- For each existing control, a pencil icon appears on the left side of the edit form to change or delete the control's settings.
- Individual controls can be moved vertically in the edit form using the Drag&Drop method. Moving consists of grabbing the control, preferably after its name located in the left column of the edit form, and then dragging it to the desired place in the edit form.
- Controls can be moved only with the “Drag&Drop” check box located above the toolbar with controls selected. For security reasons, this check box is cleared after each login to the application, so that a control is not moved by accident.
2. List of tabs in the control settings dialog
- General – Setting general properties
- View table – View table column settings
- Details – Settings for columns displayed in details
- Search – Search settings
- Help – Help text settings
- Rights – Rights settings
- Administration – Setting other properties
2.1. “General” tab
2.1.1. Common query

2.1.2. Name
- The name of the control displayed in the header of the view table.
- Placing the control name between two pipes ensures that the view table is completely hidden if no record is the result of the query – for example “|Records in the Book table|”. The view table is hidden in this way only in user mode.
- The right side can be followed by alternative HTML code, which will be displayed instead of the view table if no record is the result of the query – for example “|Records in the Book table|<img src="Images/Help.gif">”.
- The suffix “++” at the end of the name merges, in the view table, the cells of consecutive rows of the same record that have the same value. The suffix “+++” merges the cells of consecutive rows that have the same value in the first column of the view table and in the further columns within its range, and shows the value of the first column in bold. The suffix applies only to a common query when the view table displays more than one record per page, and only for a common query is it hidden from the name – for an aggregation query it remains in the name. If the name is also placed between pipes, the suffix belongs inside the pipes – for example “|Records in the Book table++|”; the text after the right pipe is always taken as alternative HTML code.
2.1.3. Dictionary
- The dictionary displays a list of names of other controls, forms, view pages, categories, applications, and application groups used throughout the application.
- The dictionary search is used to design the correct control name and to maintain the consistency of the nomenclature throughout the application so that controls with the same meaning located in different places in the application are named in the same way.
2.1.4. Width
- The width of the control, expressed in pixels.
- If this input field is not filled in, the width of the view table will be determined automatically by the web browser.
2.1.5. Data source
- The data source defines the source database records displayed in the view table.
- Data source settings are made in the graphical designer of database queries. A detailed description of the database query designer is provided in the separate guide Database query designer.
- The display of the view table is also affected by some entries in the notes of the database query. A detailed description is provided in the separate guide Database query designer.
2.1.6. Options
- Show “New Record...” icon
- Checking this box determines whether an icon should be displayed in the header of the view table, which redirects the user to a specific edit form in order to create a new record in the database.
- Both the “New record...” icon and opening a record from the view table first save the record of the edit form in which the view table is placed – the JavaScript of the “Save” button, the validation and the “OnBeforeSave” and “OnAfterSave” scripts run, including the e-mails sent by the scripts. The icon always saves the record; when a record is opened, only the write to the database itself is skipped for an unchanged record of the form, and the scripts run anyway. Navigation scheduled in the save scripts is not performed, and if the validation fails, the nested record is not opened. If the user may not change the record of the form, the record is not saved and the scripts do not run.
- Deny customization
- Checking this box determines whether individual users should be disabled from changing the column settings of this view table.
- Allow data import
- Checking this box determines whether an icon should be displayed in the header of the view table, which will allow data to be imported into the displayed database table from format files.
- XML
- XLS (X) (Excel)
- CSV (Excel)
- MDB (Access)
- ZIP – an archive containing a file in one of the above formats; the first file in the archive is processed
- The icon is not displayed for a new record that has not been saved yet, nor for a view table that reads data from a database view. Otherwise, users with administrator privileges see it in every row view table, even if this box is not checked.
- Attachments are imported only with their content (for example the XML format exported including attachments). Importing an attachment by the path to a file on the server or by the ID of an existing attachment is reserved for users with administrator privileges; the path must lead into the NET Genium installation directory unless the import is run from the local computer.
- The import does not run the save scripts of the edit form and does not queue the records for synchronization; the change history is written unless the edit form has it disabled. Allowing the import gives the user the same options as an administrator: importing by the ID column updates existing records or creates them with the given ID, and the link to the parent record (PID, PForm) and “Read-only” controls can be imported as well.
- The import runs in a dialog in three steps: selecting the file, selecting the table (for an MS Excel file, the sheet and the header row) and assigning the columns of the file to the controls. As long as no column has been assigned manually, the columns of the file are assigned automatically by matching the name or the identifier of the control.
- The “I am the owner of the imported data” option sets the importing user as the owner of the newly created records; without it, the new records have no owner. When importing by the ID column, the owner is not set.
- The “ForeignKey values are IDs - deny ID lookup by imported value” option stores foreign key values as numeric identifiers. Without it, for each value a record is looked up whose value in the values query of the foreign key matches it, and only a value that is not found is converted to a number.
- Without importing the ID column, the new records are nested under the record open in the edit form (PID, PForm); columns of the file assigned to PID or PForm take precedence.
- Each row is saved separately. An error in a row ends the import, and the rows saved before it remain in the database.
- Checking this box determines whether an icon should be displayed in the header of the view table, which will allow data to be imported into the displayed database table from format files.
- Allow MS Excel import
- Checking this box determines whether the “MS Excel Import/Export” icon should be displayed in the header of the view table. After clicking the icon, the options “Export data” and “Import data” are shown, allowing data to be exported to an MS Excel file or imported into the database table using an XLS or XLSX file. The exported XLSX file is prepared for a re-import – it contains a hidden row with the column identifiers and a hidden column with the record ID, and it does not include ID columns, password columns, attachment columns or encrypted columns. If “Deny data export” is checked, only the import is offered.
- The import only updates existing records; a record is looked up by the hidden column with the record ID. Rows without an ID or with the ID of a record that does not exist, as well as records the user is not allowed to modify, are skipped. Only the first sheet of the file is processed, the data is read from the third row, and only from the columns whose identifier is listed in the hidden first row.
- Values of RichTextBox, MultiListBox, File and Image controls, of “Read-only” controls and of controls whose value is visible only to the owner or co-owner of the record are not imported.
- Unlike “Allow data import”, the import runs the save scripts of the edit form and queues the records for synchronization; the change history is written unless the edit form has it disabled. Each row is saved separately: an error in a row ends the import and the message states the row number; the rows saved before it remain in the database. If only the “OnAfterSave” script ends with an error, the row at which the error occurred remains saved in the database as well.
- This feature is only available for view tables that do not use joins and do not read data from a database view.
- Deny data export
- Checking this box hides the icon in the header of the view table that allows the displayed data to be exported to files. The denial is checked on the server as well; users with administrator privileges can still export data. A detailed description of data export from DataGrid is provided in a separate guide DataGrid data export.
- Deny opening records
- Checking this box determines whether all users should be denied access to the edit form to open the displayed database record using the pencil icon that appears at the beginning of each row of the view table.
- Allow multiple assignments
- Checking this box determines whether a text box or drop-down list with the selected value should be displayed in the view table instead of the control value itself, with the option to change the value without opening and editing the record in the edit form.
- For a view table that reads data from a database view, this box does not apply – values cannot be changed in a cell or by the “Assign value...” item.
- This function is applied only to controls that have the “Allow multiple assignments” check box selected on the “General” tab.
- If a control has “DENYCONTROL()” in its “Notes” field, the view table displays only its value, without the option to change it.
- An anonymous user may change values in the view table under the same conditions as a logged-in user – check boxes always, other controls according to the editing rights of the record. All anonymous visitors, however, share a single user account and are therefore the owners of every record created by any of them. If the owner may change a record, any anonymous visitor may thus change records created by another visitor as well.
- Checking this box determines whether the “Assign value...” item should be available in the drop-down list of individual column filters, which is used to assign a value to all marked or filtered records in the view table.
- This function is applied only to controls that have the “Allow multiple assignments” check box selected on the “Filter” tab.
- Column filters, and therefore also the “Assign value...” item, are available to an anonymous user as well. All anonymous visitors share one user account.
- If specific records are marked in the view table, only the selected records will be assigned a value. If no records are marked, all filtered records will be assigned a value.
- If the column belongs to a joined edit form, the value is assigned to the records of the joined form in all view table rows whose record is marked, or in all filtered rows – for a join in which several joined records correspond to one record, therefore to all joined records of the marked record; the right to change a record is evaluated according to the joined form.
- Assigning a value and deleting work over the whole condition of the view table, i.e. also over records that are not displayed in the table because of the “Load only first” setting.
- If the control has the “Required field” box checked, an empty value cannot be assigned to it.
- The “OnBeforeSave” and “OnAfterSave” scripts of the edit form are run for each record separately when a value is assigned only for a control that has the “Run OnBeforeSave/OnAfterSave before the record is saved to the database” box checked; for other controls, the value is assigned without running the scripts.
- If “Show search results only” is checked, a value cannot be assigned and records cannot be deleted without an entered search term or composed filter.
- Checking this box determines whether the “Delete records in the view table” icon should be available in the view table header, which is used to delete marked or filtered records in the view table.
- Users with administrator privileges – if specific records are marked in the view table, only the marked records will be deleted. If no records are marked, all filtered records will be deleted! At most 1,000 records can be deleted at once; only the built-in “Administrator” account deletes without this limit.
- Users without administrator privileges can only delete marked specific records, they do not have permission to delete all filtered records.
- Records the user is not allowed to delete and records whose deletion is rejected by the “OnBeforeDelete” script with an error are skipped, and their number is displayed in a message after the deletion. An error of the “OnAfterDelete” script is counted among the errors as well, even though the record has already been deleted. A record whose deletion the script skips with the SKIPDELETE() function is not deleted and is not counted in the message.
- Users with administrator privileges see the icon in every view table that does not read data from a database view.
- Before the deletion, a user with administrator privileges is asked whether the “OnBeforeDelete” and “OnAfterDelete” scripts should be run on the deleted records. For a user without administrator privileges, records are always deleted one by one with these scripts run. System records are never deleted.
- A regular user sees the icon also when only “Activate marking records” is checked, and does not see it if the edit form has the “Delete” button hidden. A regular user can delete at most 1,000 records at once, and only those the user is allowed to change.
- Checking this box determines whether the “Mark records...” icon should be available in the view table header, which is used to mark individual view table records in order to delete them or assign a value using a filter.
- To the list of marked records – primary key values (“id” column) separated by a semicolon – it is possible to access using variables “#datagrid1#”, “#datagrid2#”, “#datagrid3#” etc. in the script. The index indicates the order of the view table in the edit form.
- Checking this box determines whether a text box or drop-down list with the selected value should be displayed in the view table instead of the control value itself, with the option to change the value without opening and editing the record in the edit form.
- Activate marking records
- Checking this box determines whether a check box should be automatically displayed at the beginning of each row of the view table to mark a record in order to delete it or assign a value using a filter, without using the “Mark records...” icon located in the view table header.
- The list of marked records – primary key values (column “id”) separated by a semicolon – can be accessed using the variables “#datagrid1#”, “#datagrid2#”, “#datagrid3#”, etc. in the script. The index indicates the order of the view table in the edit form.
- Checking this box determines whether a check box should be automatically displayed at the beginning of each row of the view table to mark a record in order to delete it or assign a value using a filter, without using the “Mark records...” icon located in the view table header.
- Show sums of column
- Checking this box determines whether a row with the sum of the values of the individual columns should be displayed in the footer of the view table.
- This function is applied only to TextBox controls of numeric, currency and time data types and to AutoSum controls that do not have the “Hide the sum of the column in the view table” check box selected on the “General” tab.
- Show only nested records
- Checking this box determines whether the “PID = ID record in form” constraint should be automatically appended to the database query definition.
- The condition does not take PFORM into account. If the source edit form stores nested records for several parent forms, a condition on PFORM has to be added to the database query. For a new record that has not been saved yet, the view table displays no records.
- To evaluate this condition efficiently, configure the “PID” or “PFORM + PID” index on the edit form used as the data source of the view table. Do not configure the index on the form that contains the view table.
- Hide data source
- Checking this box determines whether the contents of the view table should be automatically hidden when the edit form is opened. Database records will not be displayed to the user until the “Show” icon is clicked or clicking on the tab in which the view table is located. If the view table is located on the tab that is active when the edit form is opened, the database records are displayed immediately.
- Snap to previous control
- Checking this box determines whether the control itself should be displayed to the right of the previous one in the edit form, or whether it will be displayed below the previous control in the usual way.
2.1.7. Aggregation query without grouping by date
- Deny data export
- Checking this box hides the icon in the header of the view table that allows the displayed data to be exported to an XLSX file; the export runs without the export dialog. Users with administrator privileges can still export data.
- Show sums of columns
- Checking this box determines whether a row with the sum of the values of the individual columns should be displayed in the footer of the view table.
- This function is applied only to columns that do not use the command to hide the sum of the column using the syntax “Column@-sum”. A detailed description of the syntax of column names is given in the separate guide Database query designer.
- Hide data source
- Checking this box determines whether the contents of the view table should be automatically hidden when the edit form is opened. Database records will not be displayed to the user until the “Show” icon is clicked or clicking on the tab in which the view table is located. If the view table is located on the tab that is active when the edit form is opened, the database records are displayed immediately.
- Snap to previous control
- Checking this box determines whether the control itself should be displayed to the right of the previous one in the edit form, or whether it will be displayed below the previous control in the usual way.
2.1.8. Aggregation query with grouping by date
- Deny data export
- Checking this box hides the icon in the header of the view table that allows the displayed data to be exported to an XLSX file; the export runs without the export dialog. Users with administrator privileges can still export data.
- Fill time gaps
- Checking this box determines whether missing periods should be added to the resulting data set in the column according to which the data is grouped. Periods are added between the first and the last period found for each grouping value, not up to the limits of the time span. The numeric columns of the added rows are set to “0”, the grouping value is taken over and the text columns remain empty.
- Pivot table
- Checking this field determines whether the view table should write the data out as a pivot table – the grouping values in the rows and the individual periods in the columns.
- The field applies only to an aggregation query with grouping by date that also has the grouping columns filled in and has no custom multi-row header; otherwise it has no effect.
- If “Show sums of columns” is checked as well and the table contains more than one period and at least one non-cumulative column of a count, sum, average, maximum or minimum without the syntax “Column@-sum” or an expression column that is summed in the summary column (see below), a summary column “Σ” is added after the period columns – for a count and a sum it holds the sum of all periods, for an average the average per period, and for a maximum and a minimum the highest or lowest value; for a maximum and a minimum, periods in which the group has no record are skipped. For columns with the syntax “Column@-sum” the summary column remains empty; if all columns have this syntax, the summary column is filled in and only the totals row is hidden. Cumulative columns remain empty in the summary column. An expression column with the syntax “Column@+sum”, with the NGEF, SQL or SQLTABLE function in the expression, or with a reference to the date by which the query is grouped is summed over all periods in the summary column; other expression columns are evaluated in it over the values of the summary column.
- Clicking the header of a period displays only that period and marks its header with the text “(Active)”. The same applies to the header of the summary column “Σ”. Clicking it again displays all periods again. Selecting a period or cancelling the selection resets the sorting of the table to the default. The selected period stays selected in the user's individual settings, also the next time the view table is displayed, until the user cancels it by clicking again. If the selected period is missing in the data, all periods are displayed and the selection is cancelled by the next action in the view table.
- Show sums of columns
- Checking this box determines whether a row with the sum of the values of the individual columns should be displayed in the footer of the view table.
- This function is applied only to columns that do not use the command to hide the sum of the column using the syntax “Column@-sum”. A detailed description of the syntax of column names is given in the separate guide Database query designer.
- Hide data source
- Checking this box determines whether the contents of the view table should be automatically hidden when the edit form is opened. Database records will not be displayed to the user until the “Show” icon is clicked or clicking on the tab in which the view table is located. If the view table is located on the tab that is active when the edit form is opened, the database records are displayed immediately.
- Snap to previous control
- Checking this box determines whether the control itself should be displayed to the right of the previous one in the edit form, or whether it will be displayed below the previous control in the usual way.
2.2. “View table” tab
2.2.1. Options
- Show upper navigation toolbar
- Checking this box determines whether a toolbar with icons for switching between pages should be displayed in the header of the view table.
- By default, this toolbar is displayed in the footer of each view table if the number of data displayed is greater than the number of records on the page.
- Show filters
- Checking this box determines whether the view table should allow filtering of database records.
- A filter is offered only for columns whose control has the “Show filter in the view table” check box selected; if no column of the view table has it, the filters are not displayed.
- If a composed filter is set, the “Reset filters...” icon first resets only the composed filter; the column filters are reset by the next click.
2.2.2. Columns
- Define the default settings of view table columns.
- For an existing control, the “...” link below the “Columns” label offers the “Import columns of user” item with the login name of the logged-in user, which selects the columns according to the user's individual view table settings. The default settings change only when the control is saved.
2.2.3. The number of records per page
- For clarity, the view table uses the paging of the displayed records. This is useful in situations where the view table is retrieving large amounts of data.
- The number of records per page determines the maximum number of records that appear on one page. It is easy to switch between the individual pages using the toolbar, which is contained in each view table in its footer, or optionally in the header.
2.3. “Details” tab
2.3.1. Options
- Show details
- Checking this box determines whether the view table should display the details of each record at the bottom of the view table.
- If the box is checked, the view table search also covers detail columns that are not displayed in the view table. This does not apply to columns whose value is visible only to the owner or co-owner of the record.
- Show tooltip
- Checking this box determines whether the view table should display the details of individual records in the tooltip when the mouse hovers over individual records.
- The tooltip is not displayed on a mobile device.
2.3.2. Columns
- Define the default settings for detail columns.
- For an existing control, the “...” link below the “Columns” label offers the “Import columns of user” item with the login name of the logged-in user, which selects the columns according to the user's individual details settings. The default settings change only when the control is saved.
- The detail columns may also include view tables (DataGrid and LiteDataGrid) of the source edit form. In the details panel they are rendered as a nested view table evaluated for the displayed record.
2.4. “Search” tab
2.4.1. Options
- Activate search
- Checking this box determines whether a row with a search box and a “Search” button should be automatically displayed in the header of the view table.
- On a mobile device with a small screen, the row is not displayed automatically. Regardless of this box, the row is displayed if a search term is entered or if saved templates of the composed filter exist for the view table.
- Show search results only
- Checking this box determines whether the data in the view table should be displayed only when filling in the values in the form that are referenced by the database query constraints of that view table.
- Conditions referring to a control of the form that is not filled in (for a ForeignKey control also the value 0) are omitted in this mode, so a single filled-in value is enough for the data to be displayed. In a group of conditions joined by “or”, however, such a condition lets all records through. The data is also displayed after a search term is entered. For an aggregate query, the box does not apply – the conditions are not omitted, they are evaluated in the same way as without the box checked, and the data is displayed immediately.
- This box also determines where the term entered in the search box is evaluated. When it is checked, the search term becomes part of the database query and the search result is therefore decided by the collation of the database. When it is not checked, the records are read from the database without the search term and the term is evaluated on the records already read – such a search is case insensitive but accent sensitive, regardless of the database settings. The exceptions are controls with a full-text index on an MS SQL Server database, in which the search term is looked up by a database query in this case as well. For attachments (File and Image), the file names are read from the database and the search term is always evaluated in them on the records already read, regardless of this box and of the database settings; only the content of the files is searched by a query to the full-text catalog (see Edit form – File). In this case, the column filters and the composed filter are also evaluated on the records already read; a composed filter with the #weekend# value, however, is evaluated in the database.
- The sorting of the view table is evaluated on the records already read as well, so it does not depend on the database settings either. When the number of loaded records is limited, however, which records are read in the first place is decided by the sorting in the database and, for text values, by the collation of the database. With “Show search results only” checked, the sorting is reflected in the database query only if the query has sorting set by a column other than ID; otherwise an arbitrary part of the matching records is read, so it is advisable to set the sorting in the query.
- Searching regardless of diacritics is not set here, but on the individual controls using the “Search without diacritics” box.
2.5. “Help” tab
2.5.1. Help
- Help text is displayed to the right of the control in the edit form.
- The help texts of all controls start at the same vertical line across the entire edit form.
- Text – the help text is defined by a manually entered text string in a multi-line text field below the radio button
- From query – the help text is defined by the result of a database query that is evaluated when the edit form is opened
- A detailed description of the help text is provided in the separate guide Layout settings.
2.6. “Rights” tab
2.6.1. Rights
- Rights define a list of user groups and users who have permission to view the control on the edit form.
2.6.2. Replace rights to other controls
- The “Replace rights to other controls” function is used to unify the rights within the entire edit form for controls that are related in terms of rights.
- Thanks to the “Show...” link, it is possible to display a list of all controls in the edit form, including setting the rights of these controls. A check box is displayed for each control to select it. When the control is saved, the same rights are then set for the selected controls.
- An alternative for unifying rights within the entire edit form is to display the report available from the “Rights of child objects” tab in the edit form settings.
2.7. “Administration” tab
- The “Administration” tab is only displayed for existing controls.
2.7.1. Template name
- The template name is used to name the view table with the option to copy it when creating other view tables with the same source database table.
- When creating a new view table, it is first necessary to define the data source using a database query, and then all available templates are available in the “Templates” drop-down list on the “General” tab. After selecting a template, all parameters of the view table will be automatically pre-filled with data from the selected template.
- A list of all view tables that are marked as templates can be displayed using a report. A detailed description of the reports is provided in the separate guide Reports.
2.7.2. Other
- Change type to
- The drop-down list offers the types of controls to which conversion of the control is supported.
2.8. “Save”, “Save to all users”, “Copy”, “Delete”, and “Close” buttons
- “Save” button – Saves changes to the control settings together with the individual settings of the currently logged-in user.
- The columns on the “View table” and “Details” tabs and the “Records per page”, “Show upper navigation toolbar”, “Show filters”, “Show sums of columns”, “Show details” and “Show tooltip” options from this dialog are applied to the individual settings of this datagrid for the current user; the other individual settings of the current user, such as sorting, grid, search and the composed filter, are kept; the values selected in the column filters are deleted.
- Individual datagrid settings can be opened using the gear-icon, which is available in the icon bar in the header of every datagrid.
- Individual datagrid settings include the following options:
- Options in the “General” tab of the individual datagrid settings
- “Sort by”
- “Records per page”
- “Show upper navigation toolbar”
- “Show filters”
- “Show grid”
- “Show sums of columns”
- “Show details”
- “Show tooltip”
- Column settings in the “View table” tab of the individual datagrid settings
- Column settings in the “Details” tab of the individual datagrid settings
- Options in the “General” tab of the individual datagrid settings
- All other users will retain their individual datagrid settings. If the “Deny customization” box is checked, their individual settings are deleted in the same way as by the “Save to all users” button.
- “Save to all users” button – Saves changes to the control settings and deletes the individual settings of this datagrid for all other users so that, upon the next display of the datagrid, the default settings defined in this dialog are applied. If the Administrator account has a composed filter template saved for this datagrid, the composed filter templates of the other users except the Administrator account are deleted too. The individual settings of the current user are modified in the same way as by the “Save” button.
- “Copy” button – Creates a new copy of the current control with identical settings, but with a newly generated unique identifier.
- “Delete” button – Permanently deletes the control.
- “Close” button – Closes the control settings dialog without saving changes.
3. Behavior of the view table
3.1. Loading data, paging and sorting
- The view table loads the whole result of the database query, and paging takes place only over the loaded data. The range of loaded data is limited by the “Load only first” setting in the database query designer.
- If “Show search results only” is checked and the query does not have “Load only first” set, at most as many records are loaded as set in “Records per page”. The view table then displays and exports at most one page of results.
- Records with a duplicate value (“Remove records with duplicate”) are removed only after the data is loaded, so the table may display fewer records than “Load only first” allows.
- If a statistical view table (other than a pivot table) is grouped by date as well as by further columns and sorted by the first grouping column, the values of the grouping columns are not written out in rows whose values of all grouping columns are the same as in the previous row, and the rows remain in the order in which the database query returned them.
- Without a valid license key, the row query of the view table is limited to 100 records; a statistical view table is not limited. Licenses are not enforced in NET Genium Online, so records are not limited there even without a license key.
- A statistical view table displays 20 rows per page; the user can change the number of records per page in the paging toolbar, which is displayed if the table has more rows than fit on one page, and the change is saved to the user's individual settings. On a view page and in an edit form, a statistical view table has no individual settings dialog, no search and no filters in the column headers.
- With a common query, the view table can be sorted by clicking a column header for columns of the TextBox, ComboBox, ListBox, Radio, CheckBox, ForeignKey, DatePicker and AutoSum controls. A ForeignKey column is sorted by the value stored in the database, i.e. usually by the ID of the referenced record, not by the displayed text. Clicking the header sorts the table in ascending order by that column and cancels the second sorting, clicking it again reverses the sort direction. The “Default sort” button restores the sorting of the database query.
- A statistical view table can be sorted by clicking a column header, always by one column only; clicking it again reverses the sort direction, and the selected sorting is saved to the individual settings. The default sorting is determined by the first column whose fourth part of the name (the condition) ends with “ASC” or “DESC”, for example “Count@@@DESC”; if no column has it, the table is sorted by the first column in the sort direction set in the database query designer. The “Default sort” button restores the default sorting. A detailed description of the syntax of column names is provided in the separate guide Database query designer.
3.2. Column sums
- Sums in the footer are calculated from all filtered records, not only from the current page.
- For an aggregation query, the totals row holds a value for each column according to its type: for a count and a sum the sum of the row values, for an average the average of the row values (an empty value counts as 0), for the maximum and minimum the largest or smallest value, where rows without a value are skipped (if no row has a value, the cell remains empty), for a cumulative column the sum of its last value in each group, or of its first value for the cumulation “-1” and “--1” (without grouping columns the value of the last or the first row), and for an expression column the expression evaluated over the values of the totals row – an expression column with the syntax “Column@+sum”, with the NGEF, SQL or SQLTABLE function in the expression, or with a reference to the date by which the query is grouped is summed instead. Grouping, text and date columns remain empty in the totals row; the first column, however, holds the symbol “Σ” if it would otherwise be empty. A column with a displayed value (the third part of the column name) shows this value in the totals row as well. A detailed description of the column types is provided in the separate guide Database query designer.
- With 1,000 or more records, the sums are calculated by the database for speed, but only if the query has no external function and has not reached the “Load only first” limit; the result is therefore the same as when calculated from the loaded data. If “Remove records with duplicate” is set in the query, the sums are always calculated from the loaded data.
3.3. Opening records
- A record is opened by the link at the beginning of the row and, in user mode, also by double-clicking the row; on a mobile device and in an installation with the “SimpleClick.txt” file in the “Config” directory, clicking the row is enough. If “Show details” is checked, clicking a row displays the details of the record and the record is opened by the link, by double-clicking or from the menu described in the Details panel chapter.
- “Deny opening records” only hides the links in the view table. Opening a record by the direct address of the edit form is governed by the rights of the edit form.
- If ID is the first grouping column of an aggregation query, each row of the statistical view table carries a link that opens the record; the ID column is not included in the export.
3.4. Individual settings
- Individual settings (sorting, current page, records per page, search term, filters and columns) are saved separately for each user, with the database query of the view table.
- Except on a mobile device, the individual settings dialog (the gear icon) also offers the “Export/Import” tab. The “Export table settings” button writes the settings displayed in the dialog – sorting, records per page, the options on the “General” tab and the view table and details columns – into the “My settings” field, and the “Export search and filters” button writes the saved search term, the column filters and the composed filter. The “Import” button reads the text pasted into the field: table settings are taken over into the dialog, where they have to be saved with the “Save” button; search and filters are saved directly to the individual settings together with the settings displayed in the dialog.
- For users with administrator privileges, the dialog also offers the “Save to more users” tab. The “Save to more users” button overwrites the individual settings of the view table for the selected user groups and users according to the dialog – sorting, records per page, the options on the “General” tab and the columns; the columns only if the “Deny customization” box is not checked.
- The “Hide” icon in the header of the view table hides the data of the view table, and the “Show” icon displays it again. The state is saved to the individual settings and applies also the next time the view table is displayed. While the data is hidden, a value cannot be assigned and records cannot be deleted.
- Individual settings are not saved for the anonymous user, who has neither view table customization nor the composed filter available. The exception is the selection of view table columns: it is saved for the anonymous account when the view table is displayed for the first time and is shared by all anonymous visitors. After the default columns of the control are changed, the “Save to all users” button therefore has to be used.
- Columns to which the user has no rights are removed from the user's individual settings when they are saved.
- In NET Genium Online, a user with administrator privileges who saves individual settings (also with the “Save to more users” button) saves the default settings of the control at the same time, provided the user may change the control: the “Records per page”, “Show upper navigation toolbar”, “Show filters”, “Show sums of columns”, “Show details” and “Show tooltip” options and the view table and details columns are taken over. Sorting and the grid are not taken over into the default settings, and the individual settings of the other users are kept.
- “Show grid” is part of the individual settings only; the default settings of the control do not determine it. A statistical view table always displays the grid.
3.5. Composed filter and values in the table
- Values entered into the composed filter are inserted into the condition literally. Server functions are not evaluated in them and only date variables (e.g. #today#, #now#) and the special values #random# and #weekend# are replaced; the #dayrandom# value always gives 0 in them. The #weekend# value works only in the composed filter of the whole view table; in a composed condition of a column filter (the “Custom...” item), it selects the records with an empty date.
- Conditions of the composed filter on columns to which a user without administrator privileges has no rights are omitted. A composed filter with more than 100 conditions is not applied at all.
- On the “Templates” tab of the “Composed condition” dialog (only for the composed filter of the whole view table), the condition can be saved as a template under the name from the “Template name” field by checking the “Save as template...” box. The “Organize templates” field offers the templates the user has saved for the database query of this view table (other view tables over the same query share them); their order and removal are saved together with the dialog. The dialog can be saved only with at least one condition, which is used as the composed filter at the same time – organizing or removing templates alone cannot be saved without a condition.
- With the “Save as template...” box checked, an administrator can check the “Save to more users...” box and select user groups and users. Each of them gets the template, and the condition is also saved for them as the composed filter of the database query of this view table – their previous composed filter is replaced.
- A check box displayed in the view table can always be switched – even for a “Read-only” control and for a record of another user. Other controls can be changed in the view table only if the user is allowed to change the record and the control is not “Read-only”.
3.6. Details panel
- The details panel behaves in the same way as in a view table on a view page. A detailed description is provided in the separate guide View page – DataGrid.
4. Examples
4.1. Javascript functions
- dg_Disable();
- dg_Enable();
- dg_HideColumn(DG123, 456);
- dg_HideColumn(el(DG123), 456);
- dg_HideHeader(DG123);
- dg_SearchColumns(DG123, [1, 2, 3]);
- dg_SearchColumns(el(DG123), [1, 2, 3]);
- dg_ShowColumn(DG123, 456);
- dg_ShowColumn(el(DG123), 456);
- dg_VisibleColumns(DG123, [1, 2, 3]);
- dg_VisibleColumns(el(DG123), [1, 2, 3]);
- var array = dg_Controls(el(DG123));
4.2. Variables
- #datagrid1#
- #datagrid2#
- #datagrid3#