Skip to content

Commit 028b412

Browse files
author
Diego Torres Fuerte
committed
Handle row names instead of row numbers.
- Added style for row names, handling more width. - Added behaviour when setupCell to check on rowNames array, if present, will render the provided names.
1 parent ecf31c0 commit 028b412

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

v1/Table/DataTable.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ row numbers
3939
width: 40px;
4040
}
4141

42+
/*
43+
row names
44+
*/
45+
.maklesoft-datatable .maklesoft-datatable-rowname {
46+
text-align: right;
47+
padding : 5px;
48+
}
49+
4250
/*
4351
column names
4452
*/

v1/Table/DataTable.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ http://www.maklesoft.com
6060
if (typeof(data) == "number")
6161
return "number";
6262
}
63+
64+
03/17/2013 - Diego Torres - Handling row names instead of row numbers.
65+
6366
*/
6467
enyo.kind({
6568
name: "maklesoft.DataTable",
@@ -74,6 +77,7 @@ enyo.kind({
7477
showRowNumbers: false,
7578
showColumnNames: false,
7679
columnNames: "ABCDEFGHIJKLMNOPQURSTUVWXYZ".split(""),
80+
rowNames : [],
7781
cellClass: function(rowIndex, colIndex, data) {
7882
var className = "maklesoft-datatable-cell";
7983
if (rowIndex % 2 == 1) {
@@ -133,7 +137,11 @@ enyo.kind({
133137
if (this.showRowNumbers && this.showColumnNames && row === 0 && col === 0) {
134138
return;
135139
} else if (this.showRowNumbers && col === 0) {
140+
if(this.rowNames.length > 0){
141+
return {content: this.showColumnNames ? this.rowNames[row-1] : this.rowNames[row], className: "maklesoft-datatable-rowname"};
142+
}else{
136143
return {content: this.showColumnNames ? row-1 : row, className: "maklesoft-datatable-rownumber"};
144+
}
137145
} else if (this.showColumnNames && row === 0) {
138146
return {content: this.showRowNumbers ? this.columnNames[col-1] : this.columnNames[col], className: "maklesoft-datatable-colname"};
139147
} else {

0 commit comments

Comments
 (0)