diff --git a/build/js/ox.js b/build/js/ox.js index 405fb151..115c0667 100644 --- a/build/js/ox.js +++ b/build/js/ox.js @@ -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 diff --git a/build/js/ox.ui.js b/build/js/ox.ui.js index 8caaba8e..12589308 100644 --- a/build/js/ox.ui.js +++ b/build/js/ox.ui.js @@ -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,