mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-06 11:57:16 +08:00
Enable adding negative numbers in Number column type in Inventories [SCI-10394]
This commit is contained in:
parent
f571ec5c0c
commit
6d2de3ca12
2 changed files with 3 additions and 3 deletions
|
@ -132,8 +132,8 @@ $.fn.dataTable.render.editRepositoryNumberValue = function(formId, columnId, cel
|
||||||
});
|
});
|
||||||
|
|
||||||
$input.on('input', function() {
|
$input.on('input', function() {
|
||||||
const regexp = decimals === 0 ? /[^0-9]/g : /[^0-9.]/g;
|
const regexp = decimals === 0 ? /[^-0-9]/g : /[^-0-9.]/g;
|
||||||
const decimalsRegex = new RegExp(`^\\d*(\\.\\d{0,${decimals}})?`);
|
const decimalsRegex = new RegExp(`^-?\\d*(\\.\\d{0,${decimals}})?`);
|
||||||
let value = this.value;
|
let value = this.value;
|
||||||
value = value.replace(regexp, '');
|
value = value.replace(regexp, '');
|
||||||
value = value.match(decimalsRegex)[0];
|
value = value.match(decimalsRegex)[0];
|
||||||
|
|
|
@ -64,7 +64,7 @@ $.fn.dataTable.render.newRepositoryNumberValue = function(formId, columnId, $cel
|
||||||
});
|
});
|
||||||
|
|
||||||
$input.on('input', function() {
|
$input.on('input', function() {
|
||||||
const decimalsRegex = new RegExp(`^\\d*(\\.\\d{0,${decimals}})?`);
|
const decimalsRegex = new RegExp(`^-?\\d*(\\.\\d{0,${decimals}})?`);
|
||||||
let value = this.value;
|
let value = this.value;
|
||||||
value = value.replace(/[^0-9.]/g, '');
|
value = value.replace(/[^0-9.]/g, '');
|
||||||
value = value.match(decimalsRegex)[0];
|
value = value.match(decimalsRegex)[0];
|
||||||
|
|
Loading…
Add table
Reference in a new issue