• Resolved nwalker

    (@nwalker)


    Hi,

    I’ve installed the sorting plugin and have successfully setup sorting on a number of columns.

    In one table I am using the following CSS to enable me to sort the numbers with commas.

    “aoColumnDefs”: [ { “sType”: “numeric-comma”, “aTargets”: [ 1,2,3,4,5,6,7,] } ]

    but I also want to sort a column of images using the alt tag. I have this setup and is working ok in another table but I want to be able to sort this column in the table using this code:

    “aoColumnDefs”: [ { “sType”: “alt-string”, “aTargets”: [ 0,] } ]

    Is it possible to have both working on the same table. If so how do I code it?

    Thanks for your help
    Neil

    http://ww.wp.xz.cn/plugins/tablepress/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    thanks for your question, and sorry for the trouble.

    To combine those commands, just write them like this:

    "aoColumnDefs": [ { "sType": "numeric-comma", "aTargets": [ 1,2,3,4,5,6,7 ] }, { "sType": "alt-string", "aTargets": [ 0 ] } ]

    Now, that command will however not really make a difference yet: You’ll need to install the “alt-string” sorting algorithm first, by adding the corresponding code from http://datatables.net/plug-ins/sorting#alt to the page, e.g. by manually appending to both JS files in the TablePress Extension from http://tablepress.org/extensions/datatables-sorting-plugins/

    As a side note: You seem to have added an extra comma , at the end of each list of column numbers in that command. That can however lead to problems in Internet Explorer, so you should not have those extra commas there.

    Regards,
    Tobias

    Thread Starter nwalker

    (@nwalker)

    Thanks Tobias that works a treat.

    Happy Christmas
    Neil.

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    no problem, you are very welcome! 🙂 Good to hear that this helped!

    Best wishes,
    Tobias

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Sorting rows by column contents’ is closed to new replies.