Class: UU::DataTable::DataTable
- Inherits:
-
OS::GVC::Component
- Object
- OS::GVC::Component
- UU::DataTable::DataTable
- Includes:
- UU::DataTable
- Defined in:
- uu_datatable-0.11.6/lib/uu/datatable/datatable.rb
Overview
DataTable component.
Instance Attribute Summary (collapse)
-
- (Object) action_row_index
readonly
Returns index (first row = index 0) in original data of a row from which VUC action has been fired or nil if VUC action was not fired from datatable row.
-
- (Object) column_filter
readonly
Column filter options.
-
- (Object) column_list
readonly
Column list options.
-
- (Object) column_sort
readonly
Column sort options.
-
- (Object) column_types
readonly
Column types options.
-
- (UU::DataTable::DataTableModel) data
DataTable data representation.
-
- (Object) data_uri
readonly
Returns uri referencing JSON-formatted data object stored as an command-accessible entity (f.e. an uri of a TEXT Property).
-
- (Object) footer_row
readonly
Footer row options.
-
- (Object) head_row
readonly
Head row options.
-
- (Object) min_width
readonly
Minimal width of the DataTable.
-
- (Hash) options
readonly
Returns DataTable options as Hash object with Ruby Symbols as keys.
-
- (Object) options_uri
readonly
Returns uri referencing JSON-formatted options object stored as an command-accessible entity (f.e. an uri of a TEXT Property).
-
- (Object) page
readonly
Page options.
-
- (Object) page_size
readonly
Page size options.
-
- (Object) row_selection
readonly
Row selection options.
-
- (Array) selected_rows_indexes
Array of selected rows indexes.
-
- (Object) start_page
readonly
Start page options.
-
- (Object) style_class
readonly
Style class options.
Attributes inherited from OS::GVC::Component
#attributes, #code, #component_type, #form, #height, #id, #name, #width
Instance Method Summary (collapse)
-
- (DataTable) initialize(container, data = nil)
constructor
Creates new instance of DataTable component.
Methods included from UU::DataTable
Methods inherited from OS::GVC::Component
#add_message, #focus, #messages
Constructor Details
- (DataTable) initialize(container, data = nil)
Creates new instance of DataTable component.
400 401 402 403 404 405 406 407 408 |
# File 'uu_datatable-0.11.6/lib/uu/datatable/datatable.rb', line 400 def initialize(container, data = nil) super(container, data) # set data as Hash @attrs = attributes; json_data = @attrs[:data] if !json_data.kind_of?DataTableModel @attrs[:data] = DataTableModel.new(json_data) end end |
Instance Attribute Details
- (Object) action_row_index (readonly)
Returns index (first row = index 0) in original data of a row from which VUC action has been fired or nil if VUC action was not fired from datatable row.
503 504 505 |
# File 'uu_datatable-0.11.6/lib/uu/datatable/datatable.rb', line 503 def action_row_index @action_row_index end |
- (Object) column_filter (readonly)
Column filter options. Column filter is Array of Hashes with row filtering definition. Only rows, which contains defined string are displayed. You can use regular expressions as filter value but you must insert '/' as first and last character. You can define more than one filter. Filtering by simple string (not regular expression) is case insensitive.
239 240 241 |
# File 'uu_datatable-0.11.6/lib/uu/datatable/datatable.rb', line 239 def column_filter @column_filter end |
- (Object) column_list (readonly)
Column list options. Column list is array with column indexes in original data, which will be displayed. Columns will appear in given order. Column index is a single positive integer between 0 (index 0 = first column) and the number of columns (excluding) which is returned by UU::DataTable::DataTableModel#number_of_columns method.
156 157 158 |
# File 'uu_datatable-0.11.6/lib/uu/datatable/datatable.rb', line 156 def column_list @column_list end |
- (Object) column_sort (readonly)
Column sort options. Column sort is Array with definition of columns indexes in original data, so it is possible to sort by invisible column (filtered by #column_list). Item in Array can be Hash or simple column index as number. You can define more that one column, than if values in first column are equal, theirs order is decided by second defined column and so on. Default sorting is ascending alphabetical by CSN 97 6030. If you want another sorting manner (numeric, by date), you must define column type by UU::DataTable::DataTableModel#set_column_type.
215 216 217 |
# File 'uu_datatable-0.11.6/lib/uu/datatable/datatable.rb', line 215 def column_sort @column_sort end |
- (Object) column_types (readonly)
Column types options. Columns types is Array of Hashes with specific view parameters for column. Hash uses Ruby Symbols for keys. See documentation for more information about possible parameters and their meaning. List of possible parameters:
-
column [Numeric] Index of column to which the parameters belongs. Index is a single positive integer between 0 (index 0 = first column) and the number of columns (excluding) which is returned by UU::DataTable::DataTableModel#number_of_columns method.
-
width [Numeric] Fixed width of column in pixels. If text in cell is wider then column width, than it is wrapped automatically.
-
type [String] Type of column.
-
label [String] If label is defined, all cells in specific column contains this label, irrespective of cell value.
-
icon [Boolean] (default to: true) If is set to false, icons are not displayed in ues-links.
-
dateFormat [String] Format for date column type.
-
newWindow [Boolean] (default to: false) If link is opened to new window.
-
modalWindow [Boolean] (default to: false) If link is opened to modal window.
-
tooltipType [String] (default to: system) Type of tooltip.
-
tooltipText [String] Text for tooltip.
-
styleClass [String] Column style.
-
textColor [String] Text color.
-
numberFormat [String] Format for number column type.
-
indicateNegative [Boolean] (default to: false) If column is number type, and if it is negative, value is highlighted.
-
action [String] Name of action in VUC controller.
-
component [String] Type of component which will be displayed.
187 188 189 |
# File 'uu_datatable-0.11.6/lib/uu/datatable/datatable.rb', line 187 def column_types @column_types end |
- (UU::DataTable::DataTableModel) data
DataTable data representation. DataTableModel is used for work with DataTable inner structure, you can add, insert or remove rows and columns etc. Attribute data is not automatically filled from data_uri. Attribute data is empty until it is set for the first time. After that the attribute data keeps the data, and it can be accessed by the get method in future requests.
59 60 61 |
# File 'uu_datatable-0.11.6/lib/uu/datatable/datatable.rb', line 59 def data @data end |
- (Object) data_uri (readonly)
Returns uri referencing JSON-formatted data object stored as an command-accessible entity (f.e. an uri of a TEXT Property). This attribute is read only and can be set only as an attribute of the content component in UXML via UXML or BBcode editation.
dtt.data_uri
#output "ues:TERRITORY:ARTIFACT:object_storing_the_json"
118 119 120 |
# File 'uu_datatable-0.11.6/lib/uu/datatable/datatable.rb', line 118 def data_uri @data_uri end |
- (Object) footer_row (readonly)
If paging (page = true) or filtering (column_filter = [=> 1, :value => āPā]) is enabled, than footer rows are not displayed at all.
Footer row options. Footer row is object and determine how many rows from the end will be drawn in given style. Default style is same as header row.
370 371 372 |
# File 'uu_datatable-0.11.6/lib/uu/datatable/datatable.rb', line 370 def @footer_row end |
- (Object) head_row (readonly)
Head row options. Head row is boolean and determine if header row will be displayed. Default is true.
348 349 350 |
# File 'uu_datatable-0.11.6/lib/uu/datatable/datatable.rb', line 348 def head_row @head_row end |
- (Object) min_width (readonly)
Minimal width of the DataTable.
394 395 396 |
# File 'uu_datatable-0.11.6/lib/uu/datatable/datatable.rb', line 394 def min_width @min_width end |
- (Hash) options (readonly)
Returns DataTable options as Hash object with Ruby Symbols as keys. Modification of the returned hash object has no influence on the original options of DataTable.
108 109 110 |
# File 'uu_datatable-0.11.6/lib/uu/datatable/datatable.rb', line 108 def @options end |
- (Object) options_uri (readonly)
Returns uri referencing JSON-formatted options object stored as an command-accessible entity (f.e. an uri of a TEXT Property). This attribute is read only and can be set only as an attribute of the content component in UXML via UXML or BBcode editation.
dtt.options_uri
#output "ues:TERRITORY:ARTIFACT:object_storing_the_json"
128 129 130 |
# File 'uu_datatable-0.11.6/lib/uu/datatable/datatable.rb', line 128 def @options_uri end |
- (Object) page (readonly)
Page options. Page is boolean value and determine if rows in DataTable will be paged. Default is false.
258 259 260 |
# File 'uu_datatable-0.11.6/lib/uu/datatable/datatable.rb', line 258 def page @page end |
- (Object) page_size (readonly)
Page size options. Page size is a positive integer and determine how many rows will be on one page. Default is 25.
304 305 306 |
# File 'uu_datatable-0.11.6/lib/uu/datatable/datatable.rb', line 304 def page_size @page_size end |
- (Object) row_selection (readonly)
By this setting is affected selected_rows_indexes value
Row selection options. Row selection is object and determinate selection mode of datatable. Datatable has three selection modes. Mode "NONE" does not allow select rows. Mode "SINGLE" allows select only one row and mode "MULTI" allows select any number of rows. In "MULTI" mode datatable shows checkboxes for select rows. Checkboxes may be in first or last column. This can be defined by columnPosition attribute. If is not set, checkboxes are showed in the first column.
391 392 393 |
# File 'uu_datatable-0.11.6/lib/uu/datatable/datatable.rb', line 391 def row_selection @row_selection end |
- (Array) selected_rows_indexes
The returned value and its behavior depend on the row_selection mode setting.
Deprecated for getting the index of the row which executed the VUC action. Use action_row_index instead.
Array of selected rows indexes.
If row_selection mode is set to "NONE", this attribute returns an array with an index of the row which started the VUC action. In this mode, the attribute is read only.
If row_selection mode is set to "SINGLE" or "MULTI", this attribute contains an array of indexes of the rows selected by the user. If is set submitAllRows in rowSelection option to true, then this array contains/sets selected rows from/to whole table regerdless of the current page. Otherwise array contains/sets only selected rows on current page. Modification of the returned object has no influence on original data. A modified array may be set back to the selected_rows_indexes.
In single selection mode, this array may contain only one value, and in multi selection mode the array may contain any number of indexes. These indexes are indexes of the rows in the unmodified datatable model. Any action like adding or removing a row in the model does not affect these indexes and indexes may point to incorrect rows.
Indexes in the array are not sorted and their order is not guaranteed. For destructive actions such as removing or moving rows, it is recommended to sort the array in descending order before starting to process the indexes, otherwise it may occur that the first row is deleted first and every index after that will point to an incorrect row or may point out of bounds of the array. It is also recommended to clear the array of selected indexes after making changes that modify the datatable model. As mentioned earlier, if you want to add a row at the beginning of the datatable and keep the row selection, you must shift the indexes, too.
472 473 474 |
# File 'uu_datatable-0.11.6/lib/uu/datatable/datatable.rb', line 472 def selected_rows_indexes @selected_rows_indexes end |
- (Object) start_page (readonly)
Start page options. Start page is a positive integer and determine page number from zero (0 = first page) which will be displayed. If start page is greater than number of pages, last page is displayed. Default is 0.
282 283 284 |
# File 'uu_datatable-0.11.6/lib/uu/datatable/datatable.rb', line 282 def start_page @start_page end |
- (Object) style_class (readonly)
Style class options. Style class is a string and determine style for whole table. See documentation for possible values.
329 330 331 |
# File 'uu_datatable-0.11.6/lib/uu/datatable/datatable.rb', line 329 def style_class @style_class end |