Support » Plugin: TablePress » search only exact table value

  • Resolved weborise

    (@josephthiery)


    Dear Tobias,

    First of all, thank you very much for your beautiful Tablepress plugin. I searched all over your Tablepress website and also on the first pages of the plugin support here on WordPress (when will they have a proper search within a specific plugin?) and couldn’t find an answer. My question is also about a search feature.

    On this site, hddwarrantydot com/test-page/, I tried to implement a Search that would only pull a row result when the complete serial number is added. I wouldn’t want someone to see someone else warranty just on a keystroke. I’d rather have a click-to-find the row that has the exact value. Ideally, this search would only look for the serial number column (first column), but that’s not the most important at the moment.

    If there is an easy solution, I’d sure be happy to know about it. If not, I’d sure be happy to add my vote for such a feature in your premium extension list 🙂

    All the best.

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

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    The question is, how sensitive your information is. Using the JavaScript solution, ALL table entries are in the HTML source code of the page, so by simply using “View source” in the browser, any user could see someone else’s warranty relatively easily.

    A better solution could therefore be to use the TablePress Row Filter Extension (which does support exact cell matching and also searching in a specified column only), together with a custom search form. This approach is outlined e.g. in https://wordpress.org/support/topic/search-from-another-page/

    Regards,
    Tobias

    Ok, great ! Thank you very much !

    I actually tried to make this work before (https://datatables.net/plug-ins/api/#fnFilterOnReturn) but well, I’m not a coder and couldn’t find how to implement this.

    Anyway, I’ll try the solution you’re offering me 🙂 Thank you very much ! I’ll come back here to let you know if I could make it through and either way you’ll receive something for all your good work and swift answers ! Thank you very much !

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    a solution based on DataTables could be possible as well, but as mentioned above, it might not be practical, depending on the number of entries that your table would have, and then required level of privacy.

    The Row Filter Extension approach should be more robust here. Please let me know how things turn out!
    And thanks for wanting to donate, I really appreciate it!

    Regards,
    Tobias

    Thanks, indeed I need it to be robust. I made it work your way on my homepage hddwarrantydot com. However the full table is showing while the page is loading and it still isn’t an exact match search. Any idea how to fix that ?

    It’s normal for the donation. I can imagine you spent a lot of time working on it, and still more on answering questions for non-coders like me. So you surely deserve a little something. I already sent you one while talking with my friend. Another one will be coming tomorrow from a different address once we thought more about it.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    that’s good progress!

    The full table showing is caused by the DataTables JS library. As we won’t need that (we are only showing one row of the table), I suggest to uncheck the “Use DataTables” checkbox on the table’s “Edit” screen.

    Then, please modify the used Shortcode to
    [table_filter id=1 filter_columns=1 filter_full_cell_match=true /]
    to turn on full cell matching on the first column only.

    Please also remove that empty second row as it would otherwise interfere with the display of the table on the main page.

    With all this, the filtering should work fine, and you should only see results when the full Serial Number matches.

    Regards,
    Tobias

    🙂 Thank you very much ! I was trying to find an alternative solution but this one seems much better. However, I can’t get this to work. Once I uncheck the “Use DataTables” checkbox on the table’s “Edit” screen and take out the second empty row, then the full table is showing…

    But then the exact match value search is already working 🙂

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    ah, ok. I see what happens. We’ll need a small modification in the tablepress-shortcode-filter-get-parameter.php file.
    Please change the single } before the line
    return tablepress_get_table( $attributes );
    to

    } else {
      $attributes['filter'] = '';
    }

    Regards,
    Tobias

    Oups, I’m getting a parse error…

    I also tried your TablePress Extension: Hide Columns/Rows from logged-out users but it seems like it wasn’t done for this job…

    Well, I tried all alternatives ways of writing it, removing a space here and there or a line-break. But I’m no coder and I still receive this notification or a similar one :
    Parse error: syntax error, unexpected ‘else’ (T_ELSE) in /home/mchakypl/public_html/hddwarranty.com/wp-content/plugins/tablepress-shortcode-filter-get-parameter/tablepress-shortcode-filter-get-parameter.php on line 27

    I’m sorry, I’m just not a coder and can’t find where it’s going wrong. Any idea ?

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    the Hide Columns/Rows from logged-out users will not help here.

    Let’s focus on the Row Filter and Shortcode Filter from GET parameter Extension.

    Can you please post the content of your modified file at e.g. http://pastebin.com/ and then share the link here? There’s probably just a typo in the code.

    Regards,
    Tobias

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    ah, thanks! From what I can see, you edited the } AFTER that mentioned line, not the one BEFORE that mentioned line.
    Please replace your current version with this one:
    http://pastebin.com/DbAGhM5U

    Regards,
    Tobias

    Thank you ! I pasted your code and it unfortunately still is showing the full table info… Should I check back the “Use DataTables” checkbox on the table’s “Edit” screen instead ?

Viewing 15 replies - 1 through 15 (of 29 total)
  • The topic ‘search only exact table value’ is closed to new replies.