Skip to content

Data Grid

The data grid is the component that displays and inputs tabular data. The data grid consists of a data grid as the main body and data grid columns as column components. Data grid columns can be added/removed at will from the data grid properties.

Property

NoItemInput ValueDefault ValueAction PropertyTypeAction Default ValueDescription
1IDStringAuto-generatedidstringAuto-generatedThe [id] property cannot be set by actions.
2WidthNumber565widthnumber565Component width
3HeightNumber230heightnumber230Component height
4XNumberxnumberX coordinate position
5YNumberynumberY coordinate position
6EditableBooleanONeditablebooleantrueEnable/disable cell editing
7One Click EditBooleanOFFoneClickEditbooleantrueEnable/disable one-click editing
8PaginationBooleanOFFpaginationbooleanfalseEnable/disable pagination functionality
9VisibilityBooleanONvisibilitybooleantrueShow/hide component
10XLSX To ExportBooleanOFFexportToXlsxButtonbooleanfalseShow/hide XLSX export button
11SelectionSelection
1.Row
2.Cell
3.Complex
4.None
RowselectionstringrowSelection mode setting
12Header AdjustSelection
1.All
2.Header
3.Data
4.Off
OffHeader auto-adjustment setting
13Header Row HeightNumber40headerRowHeightnumberHeader row height
14Header Font SizeNumber14headerFontSizenumber14Header font size
15Header Word WrapSelection
1.Normal
2.Off
OffheaderWordWrapstringOffHeader word wrap setting
16Label ColorString
Color Picker
labelColorstringLabel text color
17Header ColorString
Color Picker
headerColorstringHeader background color
18Add ButtonBooleanONaddButtonbooleantrueShow/hide add row button
19Delete ButtonBooleanONdeleteButtonbooleantrueShow/hide delete row button
20Even Background ColorString
Color Picker
[Details 6]
evenBackgroundColorstringBackground color for even rows
Added in "v3.3.0"
21Odd Background ColorString
Color Picker
[Details 6]
#f7f7f7oddBackgroundColorstring#f7f7f7Background color for odd rows
Added in "v3.3.0"
22Row StyleJSON
[Details 6]
[]rowStylearray of object[]Style specification for each row
Added in "v3.3.0"
23Cell StyleJSON
[Details 6]
[]cellStylearray of object[]Style specification for each cell
Added in "v3.3.0"
24FooterBooleanOFFfooterbooleanfalseShow/hide footer
25ResizableBooleanOFFresizablebooleanfalseEnable/disable resize functionality
26Left SplitNumber0leftSplitnumber0Number of left split columns
27Page SizeNumber100pageSizenumber100Number of rows displayed per page
28ValueTable format
[Detail 1]
[Detail 1]valuearray of object[Detail 1]Data grid value
29Page EventSelection
1.None
2.Action
NoneEvent setting for page changes
30Page IndexpageIndexnumberCurrent page index
31Page Previous IndexpagePreviousIndexnumberPrevious page index
32Total CounttotalCountnumberTotal number of records
33SelectedselectedobjectData of selected row
34Deleteddeletedarray of objectData of deleted rows

[Details 1] Value

Gets and sets values for the entire table of data grid. The format of the values is an array of objects representing rows. The default status is registered as follows. Register each row from the [Add Row] button. To delete a row, click on the row to be deleted and then click the “Delete Row” button.

<DatagridID>_month<DatagridID>_companyA<DatagridID>_companyB<DatagridID>_companyC<DatagridID>_companyD
0220527234
035339055
0455308166
0530116222

When handling data in an action, data can be displayed on the data grid by setting the value (value) in the form of an array of objects, as shown in the following example. Similarly, the value (value) contains the current display data state of the data grid in the form of an array of objects.

[
{
"month": "02",
"companyA": 20,
"companyB": 52,
"companyC": 72,
"companyD": 34,
"id": "u1677456694544"
},
{
"month": "03",
"companyA": 5,
"companyB": 33,
"companyC": 90,
"companyD": 55,
"id": "u1677456694545"
},
{
"month": "04",
"companyA": 55,
"companyB": 30,
"companyC": 81,
"companyD": 66,
"id": "u1677456694546"
},
{
"month": "05",
"companyA": 30,
"companyB": 11,
"companyC": 62,
"companyD": 22,
"id": "u1677456694547"
}
]

[Details 2]When updating from actions outside the data grid

If you want to collectively update changes in the data grid from an external button without setting an action for each data grid column, the method differs between “Add Row/Update Row” and “Delete Row”.

For adding or updating rows
For adding and updating rows, use the value (value) property. It is also possible to set up an action on a datagrid column and send a request to update it each time a cell is edited, but this method will consume fewer requests. Each object of value ($value) represents row data, but it also carries information indicating the identifier (id) and status ($status) of the row data.

Operation$status value
row additionadded
row updateupdated

In case of line deletion
For row deletion, use the delete value (deleted) property. The deleted value (deleted) property allows you to retrieve the row data where the row deletion took place. Data can be retrieved by specifying something like $ui.data_grid.deleted.

[Details 3]When updating from a datagrid column action

In a datagrid column action, the row where the event occurs can be retrieved by the selected property. The selection value (selected) is a property that allows you to get the row data that is selected in the data grid. Depending on the column type, datagrid column events can be change events (onchange) or click events (onclick), both of which can be retrieved from the row object via the selected property.

[Details 4]Classification by data loading and display

The classification of data loads, characteristics, settings to make each classification and the data grid features available at each classification are described below.

Type Characteristic UI Dialog Action Data Grid Function Examples of usage scenarios
Properties What to set in the initial display and search actions What to set in the page event action Sorting Filtering Cell Editing Add Row Delete Row
Bulk Loading Collect all data and display all
  • Pagination: Off
  • Page Event:None
  • value=All data to be displayed - If you want to add or delete rows
    Pagination (Bulk Loading) Collect data and display it page by page
  • Pagination: on
  • Page Event:None
  • value = All data to be displayed - - - When there are many lines to display but scrolling is to be avoided as much as possible
    Pagination (Lazy Loading) Get data page by page and display page by page
  • Pagination: on
  • Page Event:Action
  • value=data for 1 page pagetotalCount= number of rows of all data to display value= data for 1 page - - - - - To reduce the amount of data exchanged in an action

    Warnings on Pagination (Lazy Loading)

    • When a loaded page is redisplayed, no action is performed.
    • If the value set in the action is as follows, the data will be treated as the first page of the new list.
      • When pageIndex is set to 0 and value is set to new data
      • If totalCount is changed

    [Details 5] Data Output from XLSX File Export

    Classification of data loading “Bulk Loading” and “Pagination” (Bulk Loading)

    • All data bound to the data grid will be output.
    • If data is extracted with a filter, the extracted data will be output.
    • If a footer is set, footer information is output for all data output at the bottom.

    For data loading classification “Pagination”(Lazy Loading)

    • A button to export a file in XLSX format is displayed, but the output data is not supported.

    [Details 6] Data Grid Style

    The following properties can be used to apply styles to even rows, odd rows, and individual rows and cells.
    In combination with actions, you can implement behavior such as changing styles only for specific conditions.

    • "Even Background Color"
    • "Odd Background Color"
    • "Row Style"
    • "Cell Style"

    How to set even/odd background colors

    Even background color/Odd background color specify the background color as a string or using the color picker.
    When setting from an action, set the background color as a string to the "evenBackgroundColor"/"oddBackgroundColor" action properties.

    $ui.<DataGridID>.evenBackgroundColor = "red";
    $ui.<DataGridID>.oddBackgroundColor = "#039BE5"

    How to set row style/cell style

    Row style/Cell style are set in JSON format as follows:

    Row style:

    [
    {"row": "0", "backgroundColor": "blue"},
    {"row": "1", "backgroundColor": "#ffffffff"}
    ]

    Cell style:

    [
    {"row": "0", "column": "month", "backgroundColor": "blue", "color": "white"},
    {"row": "1", "column": "companyA", "backgroundColor": "#ffffff", "color": "#039BE5"}
    ]

    When setting from an action, set styles as an array of objects to the "rowStyle"/"cellStyle" action properties.

    $ui.<DataGridID>.rowStyle = [
    {row: 0, backgroundColor: "blue"},
    {row: 1, backgroundColor: "#ffffffff"}
    ];
    $ui.<DataGridID>.cellStyle = [
    { row: 0, column: "month", backgroundColor: "blue", color: "white"},
    { row: 1, column: "companyA", backgroundColor: "#ffffff", color: "#039BE5"}
    ]

    Object properties are as follows:

    Setting TargetObject PropertyDescription
    rowStylerow1. Specify the row to apply style to as a number or string
    2. The first row is treated as row 0
    backgroundColor1. Background color of the data grid row
    2. Specify by color name or 6-digit (8-digit) code
    cellStylerow1. Specify the row of the cell to apply style to as a number or string
    2. The first row is treated as row 0
    column1. Specify the column of the cell to apply style to by column ID
    color1. Text color of the data grid cell
    2. Specify by color name or 6-digit (8-digit) code
    backgroundColor1. Background color of the data grid cell
    2. Specify by color name or 6-digit (8-digit) code

    How to clear set styles

    Setting TargetValue to SetResult
    evenBackgroundColor and oddBackgroundColorOne of the following values:
    1. null
    2. ""
    evenBackgroundColor and oddBackgroundColor are cleared, and the even and odd row background colors set in the data grid are removed.
    rowStyle and cellStyleOne of the following values:
    1. []
    2. null
    3. ""
    rowStyle and cellStyle are cleared, and the row and cell styles set in the data grid are removed.

    Event

    None