Forums

WP Table Reloaded: Want one unsorted column (4 posts)

  1. mikemcaree
    Member
    Posted 3 months ago #

    Hi. I am using WP Table Reloaded to display the results of a competition. The results can be sorted according to individual events or by the total score from adding the events together. So to make this easy for viewers I want to use a sortable table.

    WP Table Reloaded is good for this, and the results can be easily sorted by any individual column.

    What I would like, however, is for the first column not to sort. I would like a column of numbers, so that when the table is sorted a user can see the sorted results and also a numbered ranking. Currently when I sort the table, that column is sorted along with it, effectively making it only the ranking for the "total" results.

  2. cubecolour
    ɹoʇɐɹǝpoɯ
    Posted 3 months ago #

    How about using two tables butted against each other so the first able contains the static column & the second one the sortable ones? You would need to put in some extra css to target the tables & get them to look right, but I can't think of reason why that shouldn't work.

  3. mikemcaree
    Member
    Posted 3 months ago #

    I was trying that and I guess I'm not smart enough to make it work. I kept running into trouble making them line up correctly. Also, even if I got this to work, the option to light up the selected row when selected would not light up the first column.

  4. TobiasBg
    Member
    Posted 3 months ago #

    Hi Mike,

    I can see what you are trying to do, but unfortunately, I'm not aware of an existing solution to this :-(
    The quick and dirty way would indeed be a second table, as cubecolour describes. You are however correct that the row highlighting would then not work on both tables at the same time.
    Thus, a more complex solution would be needed, and that would involve some JavaScript. It should be possible to write some custom code that hooks into the DataTables JavaScript library (which does the sorting), and then uses its API to re-build that first column whenever a sorting is performed. Unfortunately, I don't have experience with that API, so I won't be able to help with that. Sorry :-(

    Best wishes,
    Tobias

Reply

You must log in to post.

About this Topic