• Resolved hatkinson

    (@hatkinson)


    Hi Meitar,

    Many thanks again for the plug-in. I have used it to create a table for my website, as follows:

    http://thinktankreview.co.uk/all-reports/

    My only problem is that the page loads with the data displayed in an unusual order. I would like the page to automatically display all of the rows in reverse chronological order, as is the case in the google spreadsheet:

    https://docs.google.com/spreadsheets/d/1exTxO2LWmxYGG8bBqZ_cifHOTzyoeF5y7FnKrb7nvio/edit#gid=1908601154

    So beginning with (and then working backwards from): Publication Year = 2015, Publication Month = 7.

    Right now, the page loads in such a way that the table displays a set of items from May 2014 at the top of the page (rather than the desired July 2015). Sorting by ‘Publication Year’ (one click on the first column heading) puts everything in order – but I would like this to be the default view if at all possible.

    I am guessing that this has something to do with jQuery DataTables. The website table mirrors the google spreadsheet exactly when I insert class=no-datatables into the shortcode. However, I don’t want to lose the DataTables functionality.

    Any help you can offer with this would be greatly appreciated.

    https://ww.wp.xz.cn/plugins/inline-google-spreadsheet-viewer/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Meitar

    (@meitar)

    Yes, you’re right. As I mentioned here:

    Sorting is provided by DataTables, on the client-side (in your browser, not on Google). So it doesn’t matter what sort order you use in your Google Sheet, DataTables will re-sort your HTML content when it receives it in your browser. If you don’t need the DataTables enhancements at all, you can disable it with class=”no-datatables” in your shortcode, and then whatever sorting you applied to the Google Sheet in the Google Sheets interface will be shown, because it’ll just display a table whose rows in your HTML source are in the same order as your Google Sheet’s rows.

    On the other hand, if you do want to use the DataTables enhancements but the built-in sorting mechanisms aren’t recognizing your particular field value, you will want to read about and use the DateTime Moment sorting plugin.

    There isn’t (yet) point-and-click integration with that plugin. Hopefully there will be later.

    Thread Starter hatkinson

    (@hatkinson)

    Thanks Meitar, that’s very helpful!

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

The topic ‘Table rows displaying in wrong order’ is closed to new replies.