textlist: make format a property of a column

This commit is contained in:
rlx 2011-01-06 06:10:46 +00:00
parent 9905848bb6
commit 07dd8d0190
2 changed files with 18 additions and 5 deletions

View file

@ -1185,6 +1185,10 @@ Format functions
================================================================================
*/
Ox.formatCurrency = function(num, str, dec) {
return str + formatNumber(num, dec);
};
Ox.formatDate = function() {
/*
See http://developer.apple.com/documentation/Darwin/Reference/ManPages/man3/strftime.3.html

View file

@ -6049,6 +6049,7 @@ requires
.defaults({
centered: false,
construct: function() {},
format: [],
itemHeight: 16,
itemWidth: 16,
keys: [],
@ -6948,8 +6949,10 @@ requires
if (Ox.isArray(v)) {
self.data[k] = v.join(', ');
} else if (format) {
self.data[k] = Ox['format' + Ox.toTitleCase(format.type)]
.apply(this, $.merge([v], format.args));
self.data[k] = Ox.isObject(format) ?
Ox['format' + Ox.toTitleCase(format.type)]
.apply(this, $.merge([v], format.args)) :
format(v);
}
});
@ -6982,7 +6985,6 @@ requires
columnsResizable: false,
columnsVisible: false,
columnWidth: [40, 800],
format: [],
id: '',
max: -1,
min: 0,
@ -7023,6 +7025,13 @@ requires
pageHeight: self.options.pageLength * self.itemHeight
});
self.format = {};
self.options.columns.forEach(function(v, i) {
if (v.format) {
self.format[v.id] = v.format;
}
});
// Head
if (self.options.columnsVisible) {
@ -7059,11 +7068,11 @@ requires
that.$body = new Ox.List({
construct: constructItem,
format: self.options.format,
id: self.options.id,
itemHeight: 16,
itemWidth: getItemWidth(),
keys: $.map(self.visibleColumns, function(v, i) {
format: self.format,
keys: $.map(self.visibleColumns, function(v) {
return v.id;
}),
max: self.options.max,