Support » Plugin: TablePress » Syntax for multiple row filter in url

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

    (@tobiasbg)

    Hi Kevin,

    thanks for your question.

    The row filter with the URL parameter works in the same way and syntax as the regular Row Filter Extension. Thus, the parameters are

    http://www.example.com/page1/?table_filter=word1||word2

    and

    http://www.example.com/page1/?table_filter=word1&&word2

    However, it might be necessary to URL-encode the value, to

    http://www.example.com/page1/?table_filter=word1%26%26word2

    Additionally, the Filtering Extension with the GET parameter needs to be modified, as it does only allow letters and numbers by default, due to this line in its code:

    $filter_term = preg_replace( '#[^a-z0-9]#i', '', $filter_term ); // only allow characters a-z, A-Z, and 0-9 in filter term

    You might want to extend that to

    $filter_term = preg_replace( '#[^a-z0-9|&]#i', '', $filter_term );

    Regards,
    Tobias

    Tobias,
    Marvelleous, the change to the extension was needed and the | characters needed to be encoded, but now works for filtering using two words for the ‘AND’ logic.

    Many thanks for the prompt feedback, very elegant plugin.

    Rgds
    Kevin

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    very nice! Great to hear that this helped!
    Thanks for the confirmation!

    Best wishes,
    Tobias

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

    Tobias,
    Just a short follow up question to your earlier point about encoding filter parameters. I’ve seen some inconsistencies in the way that the ‘-‘ character is used in filtering. I was using the text ICP-OES to filter a table, but this did not return a result. ICP OES encoded as ICP%20OES worked.
    I presume this a function of your filter term statement in the extension? Is there way of searching for text with the ‘-‘ character in it?

    Rgds
    Kevin

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi Kevin,

    this is probably also related to the escaping of the search term in the URL. Please try again after extending the line from above to

    $filter_term = preg_replace( '#[^a-z0-9|&- ]#i', '', $filter_term );

    Regards,
    Tobias

    Tobias,
    I substituted this line but got the following error

    Warning: preg_replace() [function.preg-replace]: Compilation failed: range out of order in character class at offset 11 in /homepages/29/d374934069/htdocs/labpulsar/wordpress/wp-content/plugins/tablepress-shortcode-filter-get-parameter/tablepress-shortcode-filter-get-parameter.php on line 18

    Does this make sense?

    Rgds
    Kevin

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi Kevin,

    ah, it might be necessary to escape the Regular Expression:

    $filter_term = preg_replace( '#[^a-z0-9|&\- ]#i', '', $filter_term );

    Sorry that I missed that…

    Regards,
    Tobias

    Tobias,
    Great works now. Many thanks

    Rgds
    Kevin

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    Great! Sorry again for the extra work.

    Best wishes,
    Tobias

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

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Syntax for multiple row filter in url’ is closed to new replies.