i have created bellow table using Web data Rocks
bellow is my code
const pivot = new WebDataRocks({
container: "#wdr-component",
beforetoolbarcreated: customizeToolbar,
toolbar: true,
global: {
options: {
grid: {
showFilter: true,
showReportFiltersArea: true,
},
configuratorButton: true,
drillThrough: true,
sorting: "on",
},
}
});
const report1 = {
dataSource: {
type: "json",
filename: "assets/grid/datatest.json"
},
slice: {
"rows": [{
"uniqueName": "Year"
}],
"columns": [
{
"uniqueName": "Quater"
},
{
"uniqueName": "Month"
}
],
"measures": [{
"uniqueName": "Price",
"aggregation": "sum"
}]
}
};
pivot.setReport(report1)
my datatest.json data file as follows
[
{
"Year": "2023",
"Quater": "Q1",
"Month": "January",
"Mode": "Sea",
"Destination": "Germany",
"Price": 100
},
{
"Year": "2023",
"Quater": "Q1",
"Month": "February",
"Mode": "Sea",
"Destination": "Germany",
"Price": 200
}
]
what i want is to arrange to columns by correct month order like jan, feb ... dec
i look for many resources but not able to find anyone here came cross such issue ?
i was able to archive by doing bellow, after doing more research
you need to specify the type of each property in jsondata set. so i added bellow to json array
by doing so month gets arrange by correct order.