Comments (12)
Hello Team,
We are also getting the same issue with chrome (version 108.0.5359.73) and Edge browser.
The issue occurs when we do the inline edit with the grid.
Uncaught RangeError: Value , out of range for Number.prototype.toLocaleString options property useGrouping
at Number.toLocaleString ()
at Object.formatNumber (w2ui.min.js:2:7097)
at n.format (w2ui.min.js:2:363955)
at n.change (w2ui.min.js:2:364144)
at n.init (w2ui.min.js:2:353506)
at HTMLInputElement. (w2ui.min.js:2:347575)
at Function.each (jquery-3.5.1.js:381:19)
at jQuery.fn.init.each (jquery-3.5.1.js:203:17)
at b.fn.w2field (w2ui.min.js:2:347456)
at w2grid.editField (w2ui.min.js:2:126678)
formatNumber @ w2ui.min.js:2
format @ w2ui.min.js:2
change @ w2ui.min.js:2
init @ w2ui.min.js:2
(anonymous) @ w2ui.min.js:2
each @ jquery-3.5.1.js:381
each @ jquery-3.5.1.js:203
b.fn.w2field @ w2ui.min.js:2
editField @ w2ui.min.js:2
dblClick @ w2ui.min.js:2
click @ w2ui.min.js:2
(anonymous) @ w2ui.min.js:2
dispatch @ jquery-3.5.1.js:5429
elemData.handle @ jquery-3.5.1.js:5233
from w2ui.
Temporarily fixed issue by just modifying the w2ui.min.js
return parseFloat(e).toLocaleString(w2utils.settings.locale,s)}
--->
return parseFloat(e).toLocaleString()
from w2ui.
Thank you, It's working fine.
from w2ui.
I think the error comes from this line https://github.com/vitmalina/w2ui/blob/master/src/w2utils.js#L474. I tried to play with it and cannot repeat it.
- What is the value you are formatting?
- And what is your current
w2utils.settings.locale
?
from w2ui.
Hi, I have the same error in version 1.5.
At some point useGrouping
value become ',' (comma) instead of a boolean and it generates the error:
function formatNumber (val, fraction, useGrouping) {
if (val == null || val === '' || typeof val === 'object') return '';
var options = {
minimumFractionDigits : fraction,
maximumFractionDigits : fraction,
useGrouping : useGrouping <============= HERE
};
if (fraction == null || fraction < 0) {
options.minimumFractionDigits = 0;
options.maximumFractionDigits = 20;
}
return parseFloat(val).toLocaleString(w2utils.settings.locale, options);
}
I've Temporarily fixed changing from useGrouping: useGrouping
to useGrouping: true
and it seems working.
In my case val
is 0.14 and w2utils.settings.locale
is set to 'en-us'
Bye
Alex
from w2ui.
Are you sure it is the cause? I tried this in Chrome
Number(1.43e20).toLocaleString('en-US', { useGrouping: '' })
and it did not result in the error.
from w2ui.
Strangely, but I had another user report this bug with Chrome update. I have provided a fix, can you test it. Master branch has the fix and I recompiled /dis/w2ui.js
from w2ui.
Please try
- https://github.com/vitmalina/w2ui/blob/master/dist/w2ui.js - v2.0
- https://github.com/vitmalina/w2ui/blob/w2ui-1.5/dist/w2ui.js - for v1.5
from w2ui.
The problem is that formatNumber()
is being passed "," (comma) for its useGrouping
param. When this passed to toLocaleString()
in options
, it is not a valid value per MDN.
I'm using v1.5rc1 and suspect this bug has existed for a long time, but some recent Chrome update finally made toLocaleString()
stop accepting the invalid input. Like @alzambo I just changed formatNumber()
to ignore useGrouping
and always use 'auto' in options
.
from w2ui.
@quillaja, yes, I am aware that it was sending non boolean value for useGrouping
when it only accepts booleans in new versions of Chrome. I have fixed it in both branches (1.5 and current master). Here the link to the fix: bbd9618, Now, is the new updated versions work for you?
from w2ui.
@vitmalina That seemed to work. Thank you.
from w2ui.
ok, then I am closing the issue
from w2ui.
Related Issues (20)
- regex changed in method isAlphaNumeric(val) => ids using paragraph sign are evaluated as invalid HOT 1
- How to use w2ui-2.0 in react? HOT 2
- Grid toolbar refresh with multiSearch enabled shows overlapping controls HOT 1
- Clicking in a grid without records generates script error HOT 2
- How can I prevent the loading message tip from appearing when grid.reload is called?
- Update sidebar.topHTML after initialization HOT 4
- Double-clicking on w2tab makes it invisible
- Deselecting a row with a mouse click stopped working. HOT 3
- W2db.php (server/php) doesn't work on PHP8 HOT 1
- w2grid markSearch() not properly escaping values when highlighting search results HOT 4
- Grid context menu does not close, appears multiple times on right clicks
- Grid advanced search script error when searching with empty input
- Weird ENTER key behavior in Inline Edit with selectType = Cell HOT 2
- w2grid.onSelect event not working corectly
- Как в форме в полях вывести Label большой длины, что бы не срезалось наименование поля HOT 2
- w2ui-lock
- w2grid: when property reorderColumns is true, sorting columns doesn't work as expected
- Form in a popup HOT 3
- w2ui grid - password renderer error if password undefined HOT 2
- square button shape HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from w2ui.