Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show nulls #3413

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/Plugin/tableview/Options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,18 @@ export default class Options {
* @example
* legendToggleUpdate: false
*/
updateOnToggle: true
updateOnToggle: true,

/**
* Shows null values as X in the table
* @name showNulls
* @memberof plugin-tableview
* @type {boolean}
* @default false
* @example
* showNulls: false
*/
showNulls: false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO isn't really necessary to add new option here. when the value is null, just showing a "blank" will be okay.

};
}
}
6 changes: 4 additions & 2 deletions src/Plugin/tableview/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ import {isNumber, tplProcess} from "../../module/util";
* class: "my-class-name",
* style: true,
* title: "My Data List",
* updateOnToggle: false
* updateOnToggle: false,
* showNulls: false,
* }),
* ]
* });
Expand Down Expand Up @@ -134,7 +135,8 @@ export default class TableView extends Plugin {
v.map((d, i) => tplProcess(i ? tpl.tbody : tpl.tbodyHeader, {
value: i === 0 ?
config.categoryFormat.bind(this)(d) :
(isNumber(d) ? d.toLocaleString() : "")
(isNumber(d) ? d.toLocaleString() :
config.showNulls ? "X" : "")
})).join("")
}</tr>`;
});
Expand Down