YuiRestClient::Widget::Table - Handle table objects in the UI
Copyright 2020 SUSE LLC
SPDX-License-Identifier: FSFAP
QE Yam <qe-yam at suse de>
$self->{tbl_available_devices}->select(value => $device);
Class representing a table in the UI. It can be YTable.
{
"class": "YTable",
"columns": 4,
"header": [
"header1",
"header2",
"header3",
"header4"
],
"id": "test_id",
"items": [
{
"labels": [
"test.item.1",
"",
"",
""
],
"selected": true
},
{
"labels": [
"test.item.2",
"",
"",
""
]
}
],
"items_count": 2
}
select(%args) - select a row in a table
Sends action to select a row in a table. Row can be selected either by cell value in the column (first column will be used by default), or by row number directly. If both are provided, value will be used. NOTE: row number corresponds to the position of the item in the list of column values which might differ to the display order.
The %args has has the following keys:
{value} - [String] value to select in the table
{column} - [String] column name where value is present
{row} - [Numeric] row number to select in the table
Example: Select row with value "test.item.2" for column "header1" in table
$self->{table}->select(value => 'test.item.2', column => 'header1');
Example: Select row number 3
$self->{table}->select(row => 3);
header() - returns array with the column names
items() - returns all table items
For the example table above this function would return
(["test.item.1", "", ""],["Test.item.2", "", ""])
get_index($column) - return the index of the column
The parameter $column specifies the header string that we're looking for.