Support » Plugin: TablePress » Whole Page Doesn’t Load If Filter Doesn’t Exist

  • Resolved jdobbsy1987

    (@jdobbsy1987)


    Hi,

    In reference to the fix you posted here “https://wordpress.org/support/topic/data-sorting-issue/”

    I have noticed that if a filter term doesn’t exist then the entire page page doesn’t show?

    I know it may seem odd to filter for a term that wouldn’t have any data but my plan is to essentially create a template that will be used on many pages which overtime will automatically populate based on information entered into the table so eventually those search terms will be fulfilled however i don’t want the pages to not work completely when 1 of many search terms doesn’t have any data returned.

    This is the example shortcode with 2 search terms:
    [table id=1 hide_columns="1,3,4" filter="term1&&term2" filter_full_cell_match=true row_order=sort row_order_sort_column=E row_order_sort_direction=ACC /]

    Is my shortcode wrong or is this a bug?

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

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    The problem here could be the combination of filtering and sorting. I’m not sure right now, but I could imagine that sorting an empty table somehow raises an error.
    Could you maybe test if this happens when you remove all the row order parameters from the Shortcode?

    Regards,
    Tobias

    Thread Starter jdobbsy1987

    (@jdobbsy1987)

    Thank you for your reply.

    I have tested but the issue seems to be with the filter itself, when i try with only this the page still doesn’t load:

    [table id=1 filter="term1&&term2" /]

    Cheers

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    ok, thanks for testing. This is strange then. I have seen pages with tables and empty filters before, so that should not be an issue. 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 jdobbsy1987

    (@jdobbsy1987)

    Yeah sure, take a look here – phone repair finder.com/test123/

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks! Now I see what’s going on. You have enabled the “Use DataTables” checkbox for this table. The relevant JS code however requires a non-empty table (at least one header and one body row). Without that, it will cause a JavaScript error and therefore the browser stops running all JavaScript on the page. This is what happens on your site (which you can see in the error log console in the browser). As your site relies heavily on JavaScript, you don’t see anything.
    So, you’d have to turn off the DataTables JS library here, as long as the filter does not return at least one row in the table.

    Regards,
    Tobias

    Thread Starter jdobbsy1987

    (@jdobbsy1987)

    Ah ok, but as i need JS for the sort to work regarding currency (if i’m correct from the last support thread) then i will just have to forget the template thing i mentioned earlier and only add the shortcode when i have at least 1 value being returned.

    Thank you for your support with this plugin, it’s really appreciated.

    Cheers.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    another idea could be to — temporarily, while the Shortcode is just the template — add the

    use_datatables=false
    

    parameter in the Shortcode to turn the JS library off.
    Then, when you enter the actual filter terms, you could also set the value of the parameter to true.

    Regards,
    Tobias

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Whole Page Doesn’t Load If Filter Doesn’t Exist’ is closed to new replies.