Sort arrow position (before or after ?)

Sort arrow position (before or after ?)

ptitolivptitoliv Posts: 2Questions: 0Answers: 0

Hello dear datatables team,

I'm trying to upgrade an old site using an old datatables version from 1.10 to 2.3.2. The upgrade seems fine until here except that I discovered a new behavior that I can't explain.

It's about orderable columns. On some columns the sort arrow are displayed after the column text but on some columns the sort arrows are displayed after.

After several tests it seems due to the fact the ordered data are strings or numbers.

Is it a bug due to the upgrade or a feature ? Is there a way to tell Datatables to display the sort arrows in the same way for all columns ?

Please note that I'm using Bootstrap 3.4.1.

Thanks !

Replies

  • allanallan Posts: 64,677Questions: 1Answers: 10,696 Site admin

    Hi,

    There is a description on the column header text alignment and the sorting icon position in the 2.3 blog post detailing how and why it has evolved to what you are seeing.

    However, it is absolutely possibly to left align the header text and right align the icons if that is what you want.

    These two examples show how you can use DataTable.type() to set the class name (and thus the alignment applied) to type specific columns:

    Those examples do make use of ColumnControl, but the alignment is part of DataTables core - I just happened to put the examples there. I'm going to create some for the main example set as well.

    Allan

  • ptitolivptitoliv Posts: 2Questions: 0Answers: 0

    Hello allan,

    Thanks for the pointer. I was coming from a very old datatables version and I totally missed that.

    It's now all crystal clear.

    Thanks & Best regards

Sign In or Register to comment.