search widget : widget numeric various modifications

- bugfix: when the value is given by the backen and is typed as an integer some strin operations failed, a switch has to be broken in several sub cases to handle this
- enhancement: the input is now typed as numeric so the browser prevent some miss-typing (like space and alpha)

SVN:b1162[5535]
This commit is contained in:
Bruno Da Silva
2018-03-26 15:28:33 +00:00
parent cd5dd04352
commit 40dbb2ce17

View File

@@ -103,14 +103,14 @@ $(function()
aValues = me._getValues();//TODO : tenir compte du refactoring de la structure aValues = me._getValues();//TODO : tenir compte du refactoring de la structure
// DOM elements // DOM elements
var oOpContentOuterElemFrom = $('<span class="sfc_op_content_from_outer"><label class="sfc_op_content_from_label" for=""> '+Dict.S('UI:Search:Criteria:Numeric:From')+'</label><input type="text" name="from" placeholder="'+Dict.S('UI:Search:Criteria:Numeric:PlaceholderFrom')+'"/></span>'); var oOpContentOuterElemFrom = $('<span class="sfc_op_content_from_outer"><label class="sfc_op_content_from_label" for=""> '+Dict.S('UI:Search:Criteria:Numeric:From')+'</label><input type="number" step="any" name="from" placeholder="'+Dict.S('UI:Search:Criteria:Numeric:PlaceholderFrom')+'"/></span>');
var oOpContentElemFrom = oOpContentOuterElemFrom.find('input').uniqueId(); var oOpContentElemFrom = oOpContentOuterElemFrom.find('input').uniqueId();
oOpContentOuterElemFrom.find('label').attr('for', oOpContentElemFrom.attr('id')); oOpContentOuterElemFrom.find('label').attr('for', oOpContentElemFrom.attr('id'));
if (typeof aValues[0] != 'undefined' && typeof aValues[0].value != 'undefined') if (typeof aValues[0] != 'undefined' && typeof aValues[0].value != 'undefined')
{ {
oOpContentElemFrom.val(aValues[0].value); oOpContentElemFrom.val(aValues[0].value);
} }
var oOpContentOuterElemUntil = $('<span class="sfc_op_content_until_outer"><label class="sfc_op_content_until_label" for=""> '+Dict.S('UI:Search:Criteria:Numeric:Until')+'</label><input type="text" name="until" placeholder="'+Dict.S('UI:Search:Criteria:Numeric:PlaceholderUntil')+'"/></span>'); var oOpContentOuterElemUntil = $('<span class="sfc_op_content_until_outer"><label class="sfc_op_content_until_label" for=""> '+Dict.S('UI:Search:Criteria:Numeric:Until')+'</label><input type="number" step="any" name="until" placeholder="'+Dict.S('UI:Search:Criteria:Numeric:PlaceholderUntil')+'"/></span>');
var oOpContentElemUntil = oOpContentOuterElemUntil.find('input').uniqueId(); var oOpContentElemUntil = oOpContentOuterElemUntil.find('input').uniqueId();
oOpContentOuterElemUntil.find('label').attr('for', oOpContentElemUntil.attr('id')); oOpContentOuterElemUntil.find('label').attr('for', oOpContentElemUntil.attr('id'));
if (typeof aValues[1] != 'undefined' && typeof aValues[1].value != 'undefined') if (typeof aValues[1] != 'undefined' && typeof aValues[1].value != 'undefined')
@@ -140,7 +140,9 @@ $(function()
.remove() .remove()
.end() .end()
.find('.sfc_op_content') .find('.sfc_op_content')
.append(oOpContentElem); .append(oOpContentElem)
;
}, },
_getBetweenOperatorValues: function(oOpElem) _getBetweenOperatorValues: function(oOpElem)
@@ -210,13 +212,13 @@ $(function()
case (typeof aValues[1].label == 'undefined' ): case (typeof aValues[1].label == 'undefined' ):
var sDictEntrySuffix = ':From'; var sDictEntrySuffix = ':From';
break; break;
case (aValues[0].label.trim() == '' && aValues[1].label.trim() == ''): case (aValues[0].label == '' && aValues[1].label == ''):
var sDictEntrySuffix = ':All'; var sDictEntrySuffix = ':All';
break; break;
case (aValues[0].label.trim() == '' ): case (aValues[0].label == '' ):
var sDictEntrySuffix = ':Until'; var sDictEntrySuffix = ':Until';
break; break;
case (aValues[1].label.trim() == ''): case (aValues[1].label == ''):
var sDictEntrySuffix = ':From'; var sDictEntrySuffix = ':From';
break; break;
default: default: