You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Table/DataTable.js
+64-6Lines changed: 64 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,63 @@ Copyright (c) by MaKleSoft
4
4
This code is provided "as is", without any kind of warranty.
5
5
http://www.maklesoft.com
6
6
*/
7
+
/**
8
+
A control that is designed to display and/or collect tabular data. This implementation uses the maklesoft.Table kind for displaying the data. Aside from editing cells and deleting and adding rows and columns
9
+
this control also supports various selection modes and dynamical styling of individual cells
10
+
based on indizes and values.
11
+
12
+
## properties
13
+
* rowCount: The number of rows the table should have. If no row count is specified the length of the data
14
+
array is used
15
+
Default 0
16
+
* colCount: The number of columns the table should have. If no column count is specified the maximum
17
+
column length of the data array is used
18
+
Default 0
19
+
* editable: A boolean that specifies whether or not the cells should be editable. If true, row and column
20
+
selection requires a double tap instead of a single tap
21
+
Default false
22
+
* data: A two dimensional array containing the data to be displayed. Omit this property to get a blank table
23
+
but dont forget to set the row and column count and make the table editable!
24
+
Default [[]]
25
+
* selectionMode: Determines the selection behaviour of the table. There are five different selection modes:
26
+
* maklesoft.DataTable.SelectionModes.SINGLE_ROW: One row can be selected at a time
27
+
* maklesoft.DataTable.SelectionModes.MULTI_ROW: Multiple rows can be selected at a time
28
+
* maklesoft.DataTable.SelectionModes.SINGLE_COLUMN: One column can be selected at a time
29
+
* maklesoft.DataTable.SelectionModes.MULTI_COLUMN: Multiple columns can be selected at a time
30
+
* maklesoft.DataTable.SelectionModes.NONE: No selection possible
31
+
Default: maklesoft.DataTable.SelectionModes.NONE
32
+
* showRowNumbers: Whether or not to display the row numbers
33
+
Default: true
34
+
* showColumnNames: Whether or not to use column names
35
+
Default: false
36
+
* columnNames: An array specifying the column names to be used. If this property is omitted the columns will
37
+
be labeled alphabetically
38
+
* cellClass: This can either be a string, specifying a generic class name for all cells or a function that returns a class name depending on the row index, column index and data of the cell. For more information, see 'Dynamic styling'.
39
+
40
+
## Selection
41
+
The VirtualTable kind supports various selection modes for selecting single or multiple rows or columns.
42
+
If the table is not editable the user can select a row/column by tapping/clicking on it. If the table is
43
+
editable a double click/tab is required.
44
+
Range selection is possible by tapping/clicking a row and holding it and then tapping/clicking on another row
45
+
in order to select all rows between both. Range selection is only possible in the MULTI_ROW mode.
46
+
47
+
## Adding and deleting rows columns
48
+
Rows and columns can be added or deleted at a given index or based on user selection. For more information inspect the
49
+
documentation of the respective methods.
50
+
51
+
## Data manipulation
52
+
The tables data can be manipulated programmatically or through user input. Once the editing is done the data can be
53
+
conveniently received using getData()
54
+
55
+
## Dynamic styling
56
+
Custom functions can be provided for the cellClass property in order to dynamically style cells. This function should
57
+
take the column and row index and the value of the cell and decide which css class to apply to the cell. For example the default
58
+
cellClass function returns the class name "number" if the value in the cell is a number:
Copy file name to clipboardExpand all lines: Table/DataTableExample.js
+8-2Lines changed: 8 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,19 @@
1
+
/*
2
+
@author Martin Kleinschrodt
3
+
Copyright (c) by MaKleSoft
4
+
This code is provided "as is", without any kind of warranty.
5
+
http://www.maklesoft.com
6
+
*/
1
7
enyo.kind({
2
8
name: "DataTableExample",
3
9
kind: "VFlexBox",
4
10
components: [{
5
11
kind: "Header",
6
-
components: [{content: "ScrollingVirtualTable example <br> <span style='color:gray; font-size: 12pt'>Brought to you by MaKleSoft</span>",flex: 1},
12
+
components: [{content: "DataTable example - <a href='https://github.com/MaKleSoft/enyo-plugins/tree/master/Table'>Get the code on Github</a><br> <span style='color:gray; font-size: 12pt'>Brought to you by MaKleSoft</span>",flex: 1},
0 commit comments