Hi Sarah,
Thanks for the reply. If I sort a datatable by clicking on the column header, then I can visually see that the table has been sorted by that column. I see an arrow point up or down. So my question is, how can I programmatically determine whether a column has been sorted or not? Motivation is that I sort the table, make a selection using another widget, trigger a callback, send updated data to the app using ajax. Now the column data source has changed, and the table is no longer sorted.
I get this, it make sense. So what I would like to do is to send in the ajax request whether a column(s) has been sorted or not. Then on the server side, I can be sure to send over new data that is already presorted. So technically the table would no longer have the sort triggered, but it would also be unnecessary.
So, there is an arrow on the column header, shouldn’t I be able to detect this by inspecting the datatable object?
Thanks,
Justin
···
On Sunday, November 11, 2018 at 7:51:12 AM UTC-6, Sarah Bird wrote:
Is your question how to programatically specify the sort order on DataTable?
If yes, then I’m not sure. But here’s my first take:
Having looked at the API docs - https://bokeh.pydata.org/en/latest/docs/reference/models/widgets.tables.html#bokeh.models.widgets.tables.TableColumn - I don’t think this is possible.
I think you would need to write some JavaScript to simulate the front-end click that does sorting. That would need to get triggered after the selection update.
Hopefully someone else has a better answer.
On Wednesday, November 7, 2018 at 8:40:15 AM UTC-6, Justin Griffiths wrote:
I have a Bokeh app using standalone flask. I send ajax requests to update the data source after selections are made. If I sort, then make a selection, then update the DataSource, the connected DataTable is no longer sorted. I understand why this is, what I’d like to be able to do, is to send in my ajax request which column[s], if any, were sorted and whether it is ascending/descending. I can then sort the DataFrame in the flask app before sending the updated data. So this is why I’d like to determine which columns have been sorted in a DataTable.
Welcome to other suggestions as well.
Thanks,
Justin