Closed pankus closed 7 years ago
you should be able to define multiple sorting columns in the the javascript of datatables. I belive this supports multi column ordering
Ops. I forgot to reply: yes, I can confirm that @tdamsma's solution works. However, what about a true natural sorting method? Is it possible to order a column containing alphanumeric strings with a natural order? For instance: (A1, A2, ... A10, ... A100) and not (A1, A10, A100, A2, ... )
First of all let me say that this is not an issue, but just a question. My case: I need to order a table throught four different db columns in order to obtain a 'natural sort', but of course if I add an order by clause to the definition of the initial query this propagates to any further attempt of sorting. i.e.:
query = db.session.query().select_from(MyTable).\ order_by(MyTable.col1, MyTable.col2, MyTable.col3, MyTable.col4)
At a first glance it works, but at the same time it prevent any other attempt of dynamic sorting of the table. So what I'm asking for is: How to define a custom sort option for one of the columns? Is it possible to attache a keyword argument to the column definition in order to obtain my need? As far as I can understand from the source code I cannot figure it out if it is possible... sorry I'm not a true programmer!Many thanks in advance