• Resolved onetime1a

    (@onetime1a)


    Hi there,
    first of all: great plugin! I like it very much!

    My issue:

    I want to sort a table based on values in a column.
    But these values get imported from google sheet API (shortcode) like: [get_sheet_value location=”Sheet1!B3″]. Tablepress does not extract the value for row order.

    Things I have tried and have not worked:

    tablepress single cell shortcode plugin. When referring to another cell, the row order deos not extract the value for sorting.

    Any ideas how to solve this / some workaround?

    Thank you!

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

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    Unfortunately, you can not use the Table Row Order Extension with data that from dynamic sources, like Shortcodes. Your best chance is to use the JavaScript-based sorting. Can you please post a link to the page with the table where this problem happens, so that I can take a direct look? Thanks!

    Regards,
    Tobias

    Thread Starter onetime1a

    (@onetime1a)

    Thanks Tobias,

    https://www.lukasbydzovsky.com/test/

    I want to order the rows based on the 24h vol.
    In the last row are the (reversed) ranks I put in manually.

    I want to pull the ranks also from a google sheet and then order the rows automatically ??

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for the link! In order to be able to sort by that currency value, we’d need that to stand by itself in its own column (because the sorting algorithm can’t pick it up otherwise). Could you maybe add an extra/new column to the table where you only add that currency value (via that Shortcode)? We’ll then configure the sorting for that and hide the column again.

    Regards,
    Tobias

    Thread Starter onetime1a

    (@onetime1a)

    I have now added the values in the next column. I can’t find a way to order the rows by those values. The arrows do not work.

    Sincerly,
    Lukas

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi Lukas,

    great! Now please
    – turn on the “Use DataTables” and “Sorting” checkboxes on the table’s “Edit” screen (to other features can be turned off if you don’t want them).
    – Add this to the “Custom Commands” text field on the table’s “Edit” screen:

    "columnDefs": [ { "orderable": false, "targets": [ 0, 1, 2, 3 ] }, { "visible": false, "targets": [ 3 ] }, { "orderData": [ 3 ], "targets": [ 2 ] } ], "order": [ 
    [ 2, "desc" ] ]
    

    Regards,
    Tobias

    Thread Starter onetime1a

    (@onetime1a)

    Thank you very much!
    This works but

    – I dont want to display a table header row and enable sorting by visitors.
    – it now shows only the values while hiding the currency value (which I want to be displayed)

    Any way how to remove it? Do you accept bitcoin for donation?

    regards,
    lukas

    • This reply was modified 5 years, 7 months ago by onetime1a.
    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    ah, my code has a small bug. Please try again with

    "columnDefs": [ { "orderable": false, "targets": [ 0, 1, 2, 3, 4, 5 ] }, { "visible": false, "targets": [ 5 ] }, { "orderData": [ 5 ], "targets": [ 3 ] } ], "order": [ [ 3, "desc" ] ]
    

    In addition, please add a new (empty) first row to your table.

    Then, please also add this to the “Custom CSS” textarea on the “Plugin Options” screen of TablePress:

    .tablepress-id-11 thead {
      display: none;
    }

    Regards,
    Tobias

    Thread Starter onetime1a

    (@onetime1a)

    thank you for taking the time – everything works, just sent some BTC.
    https://btc.com/fded4587b544ae5e88e06c155cfe8736d6cc8fe40c3e89c2198fffa3a466d4b0

    coffee is on me ??

    Sincerely,
    lukas

    • This reply was modified 5 years, 7 months ago by onetime1a.
    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

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

    And thanks for the coffee, I really appreciate it!

    Best wishes,
    Tobias

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

    Thread Starter onetime1a

    (@onetime1a)

    sry, I thought it worked, but it doesn’t.
    I applied all the commands and checkmarked “data tables” and “sorting”
    Any idea ?

    "columnDefs": [ { "orderable": false, "targets": [ 0, 1, 2, 3, 4, 5 ] }, { "visible": false, "targets": [ 5 ] }, { "orderData": [ 5 ], "targets": [ 3 ] } ], "order": [ [ 3, "desc" ] ]
    [ 2, "desc" ] ] 

    There are 6 columns and 9 rows.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    okay, another try:

    "columnDefs": [ { "orderable": false, "targets": [ 0, 1, 2, 3, 4 ] }, { "visible": false, "targets": [ 4 ] }, { "orderData": [ 4 ], "targets": [ 3 ] } ], "order": [ [ 3, "desc" ] ]
    

    Regards,
    Tobias

    Thread Starter onetime1a

    (@onetime1a)

    nope ?? I have applied it, but look yourself.
    I guess its because of it cant grab data from a shortcode ? ??

    regards,
    Lukas

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    please check the “Custom Commands” field again, it seems that you have a line break in the code now, so that some code is in there twice. (You can drag the field bigger in the lower right corner.)

    Regards,
    Tobias

    Thread Starter onetime1a

    (@onetime1a)

    ????

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    Good to hear that it’s working now! ??

    Best wishes,
    Tobias

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘table row based on imported data’ is closed to new replies.