Quick question...some of our users like the split dates (D+, D4+, etc), some like the dates as original (2019-08-24). Would like to enable that as an option at runtime, maybe through a custom toolbar button, or something like that.
Is that possible?
Hello,
Thank you for your question.
1) How to change the date data type during runtime:
In Flexmonster, for CSV and JSON data sources, the date data type can be changed via the defaultDateType option.
The defaultDateType
parameter specifies which data types should be applied to date fields by default, for example:
options: {
"defaultDateType": "date string"
}
This report configuration can be changed during runtime via the getReport()
and setReport()
API calls as shown in the code snippet below:
var report = pivot.getReport({withDefaults: true});
report.options.defaultDateType = "year/month/day";
pivot.setReport(report);
An important remark is that data from date fields should be in the ISO 8601 date format to work properly.
Please keep in mind that changing the data type requires reloading the data.
2) Adding a new Tab to the Toolbar:
The Toolbar can be customized using the beforetoolbarcreated event to add/remove/change the Toolbar's Tabs.
Here is a JSFiddle example for illustration: https://jsfiddle.net/flexmonster/5m0js7wr/.
Please let us know if everything works fine for you.
Best Regards,
Vera
Perfect, that is what I was looking for, thanks a bunch.