@@ -25,9 +25,24 @@ javaxt.dhtml.Table = function(parent, config) {
25
25
26
26
var defaultConfig = {
27
27
28
+
29
+ /** If true, the table will allow users to select multiple rows using
30
+ * control or shift key. Default is false (only one row is selected at
31
+ * a time).
32
+ */
28
33
multiselect : false ,
34
+
35
+
36
+ /** If true, the table will render a vertical scrollbar, allowing users
37
+ * to scroll up/down and see rows that are out of view. If false, the
38
+ * scrollbar is hidden from view. Default is true.
39
+ */
29
40
overflow : true ,
30
41
42
+
43
+ /** Style for individual elements within the component. Note that you can
44
+ * provide CSS class names instead of individual style definitions.
45
+ */
31
46
style : {
32
47
33
48
table : {
@@ -83,17 +98,20 @@ javaxt.dhtml.Table = function(parent, config) {
83
98
} ,
84
99
85
100
86
- iscroll : null //If null or false, uses inline style. If "custom",
87
- //uses, "iScrollHorizontalScrollbar", "iScrollVerticalScrollbar",
88
- //and "iScrollIndicator" classes. You can also define custom class
89
- //names by providing a style map like this:
90
- /*
101
+ /** Style for iScroll (if present). If the style is set to null or
102
+ * false, uses inline style. If a "custom" keyword is given, will
103
+ * use "iScrollHorizontalScrollbar", "iScrollVerticalScrollbar",
104
+ * and "iScrollIndicator" classes defined in your css. You can also
105
+ * define custom class names by providing a style map like this:
106
+ <pre>
91
107
iscroll: {
92
108
horizontalScrollbar: "my-iScrollHorizontalScrollbar",
93
109
verticalScrollbar: "my-iScrollVerticalScrollbar",
94
110
indicator: "my-iScrollIndicator"
95
111
}
96
- */
112
+ </pre>
113
+ */
114
+ iscroll : null
97
115
}
98
116
} ;
99
117
@@ -480,7 +498,13 @@ javaxt.dhtml.Table = function(parent, config) {
480
498
//**************************************************************************
481
499
/** Appends multiple rows to the table. On some browsers (e.g. iPad) this
482
500
* method is significantly faster than calling addRow() multiple times.
483
- * Example: table.addRows([["Bob","12/30","$5.25"],["Jim","10/28","$7.33"]]);
501
+ * Example:
502
+ <pre>
503
+ table.addRows([
504
+ ["Bob","12/30","$5.25"],
505
+ ["Jim","10/28","$7.33"]
506
+ ]);
507
+ </pre>
484
508
*/
485
509
this . addRows = function ( rows ) {
486
510
@@ -520,9 +544,14 @@ javaxt.dhtml.Table = function(parent, config) {
520
544
//** addRow
521
545
//**************************************************************************
522
546
/** Appends a row to the table and populates the cells with given values.
523
- * Example: table.addRow("Bob","12/30","$5.25");
524
- * Note that this method also accepts an array of values.
525
- * Example: table.addRow(["Bob","12/30","$5.25"]);
547
+ * Example:
548
+ <pre>
549
+ table.addRow("Bob","12/30","$5.25");
550
+ </pre>
551
+ * Note that this method also accepts an array of values. Example:
552
+ <pre>
553
+ table.addRow(["Bob","12/30","$5.25"]);
554
+ </pre>
526
555
*/
527
556
this . addRow = function ( ) {
528
557
@@ -913,12 +942,16 @@ javaxt.dhtml.Table = function(parent, config) {
913
942
//**************************************************************************
914
943
//** onKeyEvent
915
944
//**************************************************************************
945
+ /** Called whenever a keyboard event is initiated from the table.
946
+ */
916
947
this . onKeyEvent = function ( keyCode , modifiers ) { } ;
917
948
918
949
919
950
//**************************************************************************
920
951
//** focus
921
952
//**************************************************************************
953
+ /** Used to set browser focus on the table.
954
+ */
922
955
this . focus = function ( ) {
923
956
bodyDiv . parentNode . focus ( ) ;
924
957
} ;
@@ -942,15 +975,12 @@ javaxt.dhtml.Table = function(parent, config) {
942
975
//**************************************************************************
943
976
//** update
944
977
//**************************************************************************
945
- /** Called whenever rows are added or removed from the table.
978
+ /** Used to refresh the scroll bars. This method is called internally
979
+ * whenever rows are added or removed from the table.
946
980
*/
947
981
this . update = function ( ) {
948
-
949
-
950
- me . onOverflow ( me . hasOverflow ( ) ) ;
951
-
952
-
953
982
if ( me . iScroll ) me . iScroll . refresh ( ) ;
983
+ me . onOverflow ( me . hasOverflow ( ) ) ;
954
984
} ;
955
985
956
986
@@ -1053,9 +1083,13 @@ javaxt.dhtml.Table = function(parent, config) {
1053
1083
//**************************************************************************
1054
1084
//** getScrollInfo
1055
1085
//**************************************************************************
1086
+ /** Returns scroll position and dimenstions for the visible area.
1087
+ */
1056
1088
this . getScrollInfo = function ( ) {
1057
1089
return {
1090
+ x : me . iScroll ? - me . iScroll . x : bodyDiv . scrollLeft ,
1058
1091
y : me . iScroll ? - me . iScroll . y : bodyDiv . scrollTop ,
1092
+ w : bodyDiv . offsetWidth ,
1059
1093
h : bodyDiv . offsetHeight ,
1060
1094
maxY : bodyDiv . scrollHeight - bodyDiv . clientHeight
1061
1095
} ;
@@ -1077,9 +1111,11 @@ javaxt.dhtml.Table = function(parent, config) {
1077
1111
//**************************************************************************
1078
1112
/** Used to traverse all the rows in the table and extract contents of each
1079
1113
* cell. Example:
1080
- * table.forEachRow(function (row, content) {
1081
- * console.log(content);
1082
- * });
1114
+ <pre>
1115
+ table.forEachRow(function (row, content) {
1116
+ console.log(content);
1117
+ });
1118
+ </pre>
1083
1119
*
1084
1120
* Optional: return true in the callback function if you wish to stop
1085
1121
* processing rows.
0 commit comments