Skip to content

Commit 4dff6b1

Browse files
author
Jelte Lagendijk
committed
Fix isNumeric (breaking older MX-versions)
1 parent a4e22f9 commit 4dff6b1

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ChartJS",
3-
"version": "3.1.2",
3+
"version": "3.1.3",
44
"description": "This widget is a wrapper for the ChartJS library and you can use it to visualize your aggregated data.",
55
"license": "Apache License, Version 2",
66
"author": "Mendix",

src/ChartJS/widgets/Core.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,14 +418,22 @@ define([
418418
}));
419419
},
420420

421+
_isNumber: function (n, attr) {
422+
// Fix for older MX versions who do not have the .isNumeric method
423+
if (typeof n.isNumeric === "function") {
424+
return n.isNumeric(attr);
425+
}
426+
return n.isNumber(attr);
427+
},
428+
421429
_sortArrayMx: function (values, sortAttr) {
422430
logger.debug(this.id + "._sortArrayMx");
423431
return values.sort(lang.hitch(this, function (a, b) {
424432
var aa = +(a.get(sortAttr)),
425433
bb = +(b.get(sortAttr));
426434
//if the attribute is numeric
427-
aa = a.isNumeric(sortAttr) ? parseFloat(aa) : aa;
428-
bb = b.isNumeric(sortAttr) ? parseFloat(bb) : bb;
435+
aa = this._isNumber(a, sortAttr) ? parseFloat(aa) : aa;
436+
bb = this._isNumber(b, sortAttr) ? parseFloat(bb) : bb;
429437
if (aa > bb) {
430438
return 1;
431439
}

src/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<package xmlns="http://www.mendix.com/package/1.0/">
3-
<clientModule name="ChartJS" version="3.1.2" xmlns="http://www.mendix.com/clientModule/1.0/">
3+
<clientModule name="ChartJS" version="3.1.3" xmlns="http://www.mendix.com/clientModule/1.0/">
44
<widgetFiles>
55
<widgetFile path="ChartJS/widgets/BarChart/BarChart.xml"/>
66
<widgetFile path="ChartJS/widgets/LineChart/LineChart.xml"/>

0 commit comments

Comments
 (0)