Make rdt column sortable dynamically


#1

Hello, I have a Raw Data Table, but some of the columns are not sortable, i want to make them sortable when some data changes after executing a query, is that possible?, this is the config I’m using for disable the column sort:

.set("sortable", [
        {"amount":false},
        {"category":false}]
)

#2

hey @jessica, sure you can do it using a function called setSortable(column, sortable), this function allows you to change the sort config for any column


#4

I see, and where should i call this function?


#5

Well, that depends on what you need, you can use the visualization events or access its RDT api like this:

const table = cf.getVisualization('your_table')

const api = table.get('api')

api.setSortable('column', true)

#6

the api works good for me, thanks for your help