Default for aaSorting option should respect aoColumns.asSorting
Default for aaSorting option should respect aoColumns.asSorting
dharkness
Posts: 8Questions: 0Answers: 0
I have a table where I set the first column's asSorting to ['desc', 'asc']. However, the table is initially sorted in ascending order. Instead of defaulting to "[[0, 'asc']]", aaSorting should default to "[[0,aoColumns[0].asSorting[0]]]" (or null to have it calculated when the table is initially sorted).
The main problem with this feature request is that it would change the standard behavior for existing code. I would bet a beer that anyone with a table like mine already overrides aaSorting due to this issue, though.
P.S. I didn't see a Feature Request section. Should they go into the General discussion or here?
The main problem with this feature request is that it would change the standard behavior for existing code. I would bet a beer that anyone with a table like mine already overrides aaSorting due to this issue, though.
P.S. I didn't see a Feature Request section. Should they go into the General discussion or here?
This discussion has been closed.
Replies
One of these relationships will need to be "broken" I think, in order to keep the flexibility that asSorting and aaSorting provide. I can't really see a way to allow for both that wouldn't break under certain circumstances... What do you think?
Also, general discussion is fine for this kind of thing :-)
Regards,
Allan
In your example you provide a full aaSorting array so this change wouldn't affect it AFAICT. In my case I want the default sorting to be the first sorting direction of the first column, but since that isn't 'asc' I need to tell it to use 'desc' twice: once in asSorting and again in aaSorting.
Thanks very much for the clarification - I get it now :-). Yes indeed this is possible if we allow aaSorting to override whatever else goes with asSorting, which I think is the correct thing to do.
As such I've just implemented what you are looking for and I'll release it along with 1.6.1 shortly :-)
Regards,
Allan