- Timestamp:
- 03/05/10 13:36:50 (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Xul_Commons/modules/scenariCommons/widgets/jsTree/cellBuilders.jsm
r14883 r15040 41 41 42 42 Components.utils.import("resource://scenariCommons/commons/basis.jsm"); 43 Components.utils.import("resource://scenariCommons/commons/i18n.jsm"); 43 44 Components.utils.import("resource://scenariCommons/widgets/jsTree/jsTree.jsm"); 44 45 … … 185 186 * la propriété nommée pDataKey des rows. 186 187 */ 187 function CellBuilderLeafDate(pDataKey, pSortable ){188 function CellBuilderLeafDate(pDataKey, pSortable, pFormat){ 188 189 this.fDataKey = pDataKey; 189 190 if(pSortable) this.fSortable = true; 191 if(pFormat) this.fFormat = pFormat; 190 192 } 191 193 CellBuilderLeafDate.prototype.__proto__ = CellBuilderBase.prototype; 192 194 CellBuilderLeafDate.prototype.getCellText = function(pJsTreeRow, pCol) { 193 195 if(!pJsTreeRow || pJsTreeRow.fCh) return ""; 194 return new Date(pJsTreeRow.fDatas[pJsTreeRow.getIdxColumn(this.fDataKey)]).toLocaleString(); 196 var vDate = new Date(pJsTreeRow.fDatas[pJsTreeRow.getIdxColumn(this.fDataKey)]); 197 if (this.fFormat) { 198 function pad(n) { return n<10 ? '0'+n : n; }; 199 var vFullYear = vDate.getFullYear(); 200 var vLocaleDate = i18n.formatStr(this.fFormat, 201 vFullYear, 202 pad(vDate.getMonth()), 203 pad(vDate.getDate()), 204 pad(vDate.getHours()), 205 pad(vDate.getMinutes()), 206 pad(vDate.getSeconds()), 207 pad(vFullYear % 100) 208 ); 209 return vLocaleDate; 210 } else return vDate.toLocaleString(); 195 211 } 196 212 CellBuilderLeafDate.prototype.cycleHeader = CellBuilderLeafString.prototype.cycleHeader;
Note: See TracChangeset
for help on using the changeset viewer.