From 8241e3793af07518c66cad28ec09974d8367cc33 Mon Sep 17 00:00:00 2001 From: peterboccia Date: Mon, 29 Sep 2014 14:56:51 +0200 Subject: [PATCH] Add the currency field type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use case example: field definition ... , Price: { title: 'Price', type: 'currency', currencyType: '$' // default €, if you don't need to change you can avoid to declare this } I needed to add this to my project. If you like you can update yours. Cheers, Peter Boccia --- lib/jquery.jtable.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/jquery.jtable.js b/lib/jquery.jtable.js index 869af246..151ea9fd 100644 --- a/lib/jquery.jtable.js +++ b/lib/jquery.jtable.js @@ -741,7 +741,11 @@ THE SOFTWARE. return this._getDisplayTextForDateRecordField(field, fieldValue); } else if (field.type == 'checkbox') { return this._getCheckBoxTextForFieldByValue(fieldName, fieldValue); - } else if (field.options) { //combobox or radio button list since there are options. + } else if (field.type == 'currency') { + var curr = field.currencyType || '€'; + var money = fieldValue || 0; + return curr + '' + money.toFixed(2); + }else if (field.options) { //combobox or radio button list since there are options. var options = this._getOptionsForField(fieldName, { record: record, value: fieldValue,