From fbe7831f7765d62853641750b85861b19a2a8715 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Wed, 5 Apr 2017 09:38:40 +0500 Subject: Handle allowDecimals config --- web/app/view/dialog/AttributeController.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'web/app/view/dialog') diff --git a/web/app/view/dialog/AttributeController.js b/web/app/view/dialog/AttributeController.js index 7ddab11c..ca1436fd 100644 --- a/web/app/view/dialog/AttributeController.js +++ b/web/app/view/dialog/AttributeController.js @@ -54,19 +54,19 @@ Ext.define('Traccar.view.dialog.AttributeController', { onNameChange: function (combobox, newValue) { var type, config, valueField = this.lookupReference('valueField'), - attribute = combobox.getStore().getById(newValue); + attribute = combobox.getStore().getById(newValue); if (attribute) { type = attribute.get('type'); config = Ext.clone(this.defaultFieldConfig); if (type === 'number') { config.xtype = 'numberfield'; - config.allowDecimals = false; - if (attribute.get('maxValue')) { - config.maxValue = attribute.get('maxValue'); - } - if (attribute.get('minValue')) { - config.minValue = attribute.get('minValue'); + if (attribute.get('allowDecimals') !== undefined) { + config.allowDecimals = attribute.get('allowDecimals'); + } else { + config.allowDecimals = true; } + config.maxValue = attribute.get('maxValue'); + config.minValue = attribute.get('minValue'); } else if (type === 'boolean') { config.xtype = 'checkboxfield'; config.inputValue = true; @@ -80,8 +80,7 @@ Ext.define('Traccar.view.dialog.AttributeController', { this.getView().down('form').insert(this.getView().down('form').items.indexOf(valueField), config); this.getView().down('form').remove(valueField); } else if (config.xtype === 'numberfield') { - valueField.setMinValue(config.minValue); - valueField.setMaxValue(config.maxValue); + valueField.setConfig(config); } } } -- cgit v1.2.3