Drop-down menu sorting and widget searching
-
Hello,
We are looking to replace our current table data plugin with TablePress. I’ve tested it and it seems like a fairly smooth transition. My question is can results be filtered via a drop down menu as shown under All Entries on this page: http://bondline.net/datasheets_sds/adhesive-by-application/
Also can the plugin deliver page results via a widget search either through search box, text links or drop-down menu filtering by category on the results page?
The plugin looks great. Thanks!
-
Hi,
thanks for your post, and sorry for the trouble.
To add such drop-down filter, you could use the TablePress Extension from https://tablepress.org/extensions/datatables-columnfilterwidgets/
Prefiltering is possible to some degree, using the approach from https://ww.wp.xz.cn/support/topic/link-to-search-field/
Regards,
TobiasHi,
Thanks for the great plugin! I am having some trouble with the prefiltering. I have installed the DataTables Automatic Filtering plugin and I’m trying to create a hyperlink within my widgets to filter the table by search criteria. Here are two examples:
<a href="http://digital805.com/beai/datasheets_sds/adhesive-by-properties/?table_filter=ELECTRICALLY CONDUCTIVE">ELECTRICALLY CONDUCTIVE</a>
<a href="http://digital805.com/beai/datasheets_sds/adhesive-by-properties/?table_filter=FLEXIBLE">FLEXIBLE</a>I’m a bit lost by the instructions. Can you help?
Thank you!
I also installed Shortcode Filter from GET parameter plugin and still not working. Do I need. Do I need the row filtering extension as well? I’m happy to make a donation once I get it working. Thank you!
I went ahead and added the row filtering extension and still no luck.
I also applied the code change, in the GET parameter plug in, where
'filter'is changed to'datatables_auto_filter', like this:
$attributes['datatables_auto_filter'] = $filter_term;Per the instructions row filtering not needed and has been disabled.
I’m sorry for the multiple submissions. This is my final step before launching. Thank you!
-
This reply was modified 8 years, 11 months ago by
Digital 805. Reason: additional changes made
Hi,
yes, you will need the Shortcode Filter from GET parameter Extension and the DataTables Automatic Filtering Extension.
Did you modify the Shortcode to[table_filter ...as mentioned on the explanation page from my link above?Regards,
TobiasHi, The table filter shortcode is working fine on the page. I’m trying to create a simple text link from elsewhere within the site like this:
<a href="http://digital805.com/beai/datasheets_sds/adhesive-by-properties/?table_filter=FLEXIBLE">FLEXIBLE</a>I have installed Shortcode Filter from GET parameter plugin and DataTables Automatic Filtering.
Using the shortcode would work too, but I want the drop down to display on it’s own page and then filter when directing to the page that contains the data.
I hope that is clear. Thanks!
Hi,
the URL http://digital805.com/beai/datasheets_sds/adhesive-by-properties/?table_filter=FLEXIBLE doesn’t seem to be working yet.
So something in the chain of Extensions is not yet set-up properly.Combining this with the drop-down from the ColumnFilterWidgets Extension will however not work like that. If you want to use a drop-down to select the filtered word (instead of using links), you will have to create a custom drop-down and then maybe redirect to the correct URL using jQuery.
Regards,
TobiasOk, thank you. If the drop-down wont work out of the box, I’ll stick with the direct link. You said, “So something in the chain of Extensions is not yet set-up properly.” What do you mean by that? Is it something in your plugin or something that I didn’t do? Can you provide direct instructions on this type of link? Thank you.
Hi,
what I mean: When I use the link, the table is not filtered.
So, either one of the Extensions is not activated, or the Shortcode on that page is not set to[table_filter ... /]or you did not modify the “Shortcode Filter From GET parameter” Extension according to https://ww.wp.xz.cn/support/topic/link-to-search-field/#post-7561044 .Regards,
TobiasYes, I changed the code. Here is the entire php.
<?php /* Plugin Name: TablePress Extension: Shortcode Filter from GET parameter Plugin URI: https://tablepress.org/extensions/shortcode-filter-get-parameter/ Description: Custom Extension for TablePress to use the Row Filter extension with a filter term from a $_GET parameter Version: 1.0 Author: Tobias Bäthge Author URI: https://tobias.baethge.com/ */ /* * The Shortcode: [table_filter id=123 /] * will be filtered for http://example.com/?table_filter=myfilterword */ function tablepress_filter_shortcode( $attributes, $content ) { if ( ! empty( $_GET['table_filter'] ) ) { $filter_term = $_GET['table_filter']; /* * Only allow characters a-z, A-Z, 0-9, and spaces in the filter term. * This regular expression needs to be extended if other characters shall be allowed. */ $filter_term = preg_replace( '#[^a-z0-9 ]#i', '', $filter_term ); $attributes['datatables_auto_filter'] = $filter_term; } return tablepress_get_table( $attributes ); } if ( ! is_admin() ) { add_shortcode( 'table_filter', 'tablepress_filter_shortcode' ); }Here is my shortcode for the page:
[table_filter id=4 datatables_columnfilterwidgets=true datatables_columnfilterwidgets_exclude_columns=1,3,4,5 /]Thanks for your help.
-
This reply was modified 8 years, 11 months ago by
Digital 805.
Hi,
ok, and are you using that
[table_filter ... /]Shortcode on the page http://digital805.com/beai/datasheets_sds/adhesive-by-properties/?table_filter=FLEXIBLE ?And are both the Shortcode Filter from GET parameter Extension and the DataTables Auto Filter Extension activated as WordPress plugins?
Regards,
TobiasHere is my shortcode:
[table_filter id=4 datatables_columnfilterwidgets=true datatables_columnfilterwidgets_exclude_columns=1,3,4,5 /]The plugins I have activated are:
TablePress Extension: DataTables Automatic Filtering
TablePress Extension: DataTables ColumnFilterWidgets
TablePress Extension: Shortcode Filter from GET parameterHi,
great! I just checked http://digital805.com/beai/datasheets_sds/adhesive-by-properties/?table_filter=FLEXIBLE again and the filter term is now automatically added the Search field 🙂 So this process is now working and you can use any such URLs to get a pre-filtered table 🙂
Regards,
TobiasI see what it doing now. It is pulling keywords from the description, rather than displaying the property category ‘flexible’ as the drop down does. How can I get it to display to exclude_columns=1,3,4,5 and function like the drop down on that page?
Hi,
as mentioned above, that’s not directly possible with the ColumnFilterWidgets Extension. You would now need to add custom HTML code for such a drop-down field, and custom JavaScript code that reacts to a change in the selected value (e.g. using jQuery). Then, the JS code could redirect to the new page with the new search term.
Regards,
Tobias -
This reply was modified 8 years, 11 months ago by
The topic ‘Drop-down menu sorting and widget searching’ is closed to new replies.