• Resolved Glowball

    (@glowball)


    I have a table with the first column holding dates formatted like yyyy-mm-dd. I have the “TablePress Extension: DataTables Sorting plugins” extension installed and enabled. I’d like to have the date recognized in that format, and have the table sorted in descending date order upon load (default). When I use the following snippet the column is recognized:

    "columnDefs": [ { "type": "date-us", "targets": [ 0 ] } ]

    How do I include the command for the default sort? I’ve seen this listed as a sorting solution, but I’m not sure how to add it to what I have already:

    "order": [ [ 0, "desc" ] ]

    Thanks for the tips!

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    To combine these commands, just put a comma , between them. That should be sufficient here.

    That said, for the yyyy-mm-dd date format, you should not actually need the TablePress DataTables Sorting plugins Extensions nor that first part of the “Custom Command”, as that date format will also sort correctly with text/string sorting.

    And for the second part of the command (to achieve that sorting when the page is opened), you could instead also just sort the table on the “Edit” screen here (by double-clicking on the column letter in the head row). This way, the table would already be sorted like that when it is sent to the browser and the JS code wouldn’t have to do this step every time.

    Best wishes,
    Tobias

    Thread Starter Glowball

    (@glowball)

    Thank you! I was making things more difficult than they needed to be. It’s working for me now. Great plugin!

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

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

    Best wishes,
    Tobias

    P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Combining DataPress Parameters’ is closed to new replies.