Viewing 13 replies - 1 through 13 (of 13 total)
  • Thread Starter Anthony Valentine

    (@npoutdoors)

    I take it I need help with DataTables sorting Plugin. I need to sort the first column alphabetically, and the rest need to be sorted by highest to lowest/lowest to highest.

    I can’t seem to figure out the datatables documentation and what commands to use.

    Thread Starter Anthony Valentine

    (@npoutdoors)

    This seems to be working: does this make sense?

    “columnDefs”: [ { “type”: “formatted-num”, “targets”: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 ] } ]

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for your question, and sorry for the trouble.

    Unfortunately, I don’t see a table on that page, but only a “table not found” message?

    As for the padding, this might also be affected by the “line height”. I’ll gladly confirm that once the table is visible again.

    Regarding the sorting: This is caused by those cells that have “NULL” in them. This changes the sorting to text instead of number sorting, which causes the different results. Your approach with that “Custom Command” should indeed work here.

    Regards,
    Tobias

    Thread Starter Anthony Valentine

    (@npoutdoors)

    Sorry about that. Have a look now!

    I’ll remove the nulls and replace them with 0s or do emtpy cells work too?

    Thread Starter Anthony Valentine

    (@npoutdoors)

    The command I’m using seems to be working with the NULL in there?

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    I still only see

    [table “” not found /]
    

    But yes, replacing it with 0 should work fine. In that case, you could go without using that “Custom Command”.

    Regards,
    Tobias

    Thread Starter Anthony Valentine

    (@npoutdoors)

    So sorry.

    I keep forgetting and removing it ):!!

    OK One last time. It’s in place now.

    Ok so you’re saying if I remove the NULLs then I won’t need the command?

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks! Now I can see the table ??

    Yes, if you change the NULL to 0, you would not need the “Custom Command”. (It could also work with empty cells instead of NULL, but I’m not sure right now. For a test, you could replace all NULL in one column with an empty value.)
    But of course you can also keep the “Custom Command”, if you prefer to use NULL here.

    Regards,
    Tobias

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    oh, and about the padding: It seems that the CSS for that is working now? I can see that you set the padding to 15px successfully.

    By the way, there’s one “s” to much in “Potasssium” ??

    Best wishes,
    Tobias

    Thread Starter Anthony Valentine

    (@npoutdoors)

    Nice catch! Thanks so much, I’ would have most likely never seen that S haha!

    is there any way to freeze the 1st column so when you scroll it stays in place?

    I’ll be sure to review your plugin.

    Thanks!

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    Good to hear that this helped!

    You could take a look at the TablePress Extension from https://tablepress.org/extensions/datatables-fixedcolumns/ for that ??

    Regards,
    Tobias

    Thread Starter Anthony Valentine

    (@npoutdoors)

    Amazing.

    Thanks so much Tobias.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    sure, always happy to help! ??

    Best wishes,
    Tobias

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Th Padding and Sorting Problem’ is closed to new replies.