Skip to content

Commit

Permalink
Merge pull request #7 from dataiku/bug/bug/dss13-sc-206483-the-table-…
Browse files Browse the repository at this point in the history
…s-numerical-filter-doesn-t-exclude2

Properly handle 0 as rowValue during filter.
  • Loading branch information
louisdorard authored Oct 7, 2024
2 parents fbc820d + 3b3a348 commit 64727b2
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 14 deletions.
30 changes: 19 additions & 11 deletions dash_tabulator/assets/custom_tabulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,20 +121,28 @@ window.myNamespace = Object.assign({}, window.myNamespace, {
//rowValue - the value of the column in this row
//rowData - the data for the row being filtered
//filterParams - params object passed to the headerFilterFuncParams property
if (rowValue) {
if (headerValue.start != "") {
if (headerValue.end != "") {
return rowValue >= headerValue.start && rowValue <= headerValue.end;
} else {
return rowValue >= headerValue.start;
}

// No filter set, all values pass.
if (headerValue.start === "" && headerValue.end === "") {
return true
}

// Filter set, empty or NaN values fail.
if (rowValue == null || rowValue === "" || isNaN(Number(rowValue))) {
return false;
}

if (headerValue.start != "") {
if (headerValue.end != "") {
return rowValue >= headerValue.start && rowValue <= headerValue.end;
} else {
if (headerValue.end != "") {
return rowValue <= headerValue.end;
}
return rowValue >= headerValue.start;
}
} else {
if (headerValue.end != "") {
return rowValue <= headerValue.end;
}
}
return true; //must return a boolean, true if it passes the filter.
},

minMaxFilterEditor: function (cell, onRendered, success, cancel, editorParams) {
Expand Down
2 changes: 1 addition & 1 deletion dash_tabulator/src/lib/components/DashTabulator.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import "../../../assets/semantic.min.css";

const crypto = require('crypto');

const plugin_version = "2.0.2";
const plugin_version = "2.0.3";

function md5(string) {
return crypto.createHash('md5').update(string).digest('hex');
Expand Down
2 changes: 1 addition & 1 deletion dss-plugin-visual-edit/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "visual-edit",
"version": "2.0.2",
"version": "2.0.3",
"meta": {
"label": "Visual Edit",
"description": "Spin up a visual app to validate and edit data",
Expand Down

Large diffs are not rendered by default.

0 comments on commit 64727b2

Please sign in to comment.