Hello i’m using a Raw Data Table
in a react application, i have some components tha are rendered based on a query using the Chartfactor querying data syntax, I need to detect when a table column is sorted and take that sorting configuration to apply it to the group with the same name as that column within the corresponding query, is that possible?
Detect sorting in table
steven
#1
emoya
#2
Yes, you can use the sort-changed event in the Raw Data Table, let me show you an example:
let myChart = myData.graph("Raw Data Table")
.limit(100)
.on("sort-changed", data => console.log(data))
.execute();
// this will print an object like this:
//{
// "name": "sort-changed",
// "chart": "visf7ea8336-aafa-487a-8c28-3a12166b4d49",
// "data": [
// {
// "colId": "company",
// "sort": "asc"
// }
// ]
//}
The colId
property is the field name, so with that you can do your changes