Class: UU::DataTable::DataTable
- Inherits:
-
OS::GVC::Component
- Object
- OS::GVC::Component
- UU::DataTable::DataTable
- Includes:
- UU::DataTable
- Defined in:
- uu_datatable-0.4.6/lib/uu/datatable/datatable.rb
Overview
DataTable component.
Instance Attribute Summary (collapse)
-
- (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) footer_row
readonly
Footer row options.
-
- (Object) head_row
readonly
Head row options.
-
- (Hash) options
readonly
Returns DataTable options as Hash object with Ruby Symbols as keys.
-
- (Object) page
readonly
Page options.
-
- (Object) page_size
readonly
Page size options.
-
- (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.
-
- (Array) selected_rows_indexes
Returns array of selected row's indexes (first row = index 0) in original data.
Methods inherited from OS::GVC::Component
#add_message, #focus, #messages
Constructor Details
- (DataTable) initialize(container, data = nil)
Creates new instance of DataTable component.
345 346 347 348 349 350 351 352 |
# File 'uu_datatable-0.4.6/lib/uu/datatable/datatable.rb', line 345 def initialize(container, data = nil) super(container, data) # set data as Hash json_data = attributes[:data] if !json_data.kind_of?DataTableModel attributes[:data] = DataTableModel.new(json_data) end end |
Instance Attribute Details
- (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.
208 209 210 |
# File 'uu_datatable-0.4.6/lib/uu/datatable/datatable.rb', line 208 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.
125 126 127 |
# File 'uu_datatable-0.4.6/lib/uu/datatable/datatable.rb', line 125 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.
184 185 186 |
# File 'uu_datatable-0.4.6/lib/uu/datatable/datatable.rb', line 184 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.
156 157 158 |
# File 'uu_datatable-0.4.6/lib/uu/datatable/datatable.rb', line 156 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.
49 50 51 |
# File 'uu_datatable-0.4.6/lib/uu/datatable/datatable.rb', line 49 def data @data 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.
339 340 341 |
# File 'uu_datatable-0.4.6/lib/uu/datatable/datatable.rb', line 339 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.
317 318 319 |
# File 'uu_datatable-0.4.6/lib/uu/datatable/datatable.rb', line 317 def head_row @head_row 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.
97 98 99 |
# File 'uu_datatable-0.4.6/lib/uu/datatable/datatable.rb', line 97 def @options end |
- (Object) page (readonly)
Page options. Page is boolean value and determine if rows in DataTable will be paged. Default is false.
227 228 229 |
# File 'uu_datatable-0.4.6/lib/uu/datatable/datatable.rb', line 227 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.
273 274 275 |
# File 'uu_datatable-0.4.6/lib/uu/datatable/datatable.rb', line 273 def page_size @page_size 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.
251 252 253 |
# File 'uu_datatable-0.4.6/lib/uu/datatable/datatable.rb', line 251 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.
298 299 300 |
# File 'uu_datatable-0.4.6/lib/uu/datatable/datatable.rb', line 298 def style_class @style_class end |
Instance Method Details
- (Array) selected_rows_indexes
Returns array of selected row's indexes (first row = index 0) in original data.
373 374 375 |
# File 'uu_datatable-0.4.6/lib/uu/datatable/datatable.rb', line 373 def selected_rows_indexes attributes[:selectedRows].freeze end |