Extension 6: Showing only rows that match a filter

March 4th, 2010 by Tobias Leave a reply »

Some people have approached me with an idea like this one: They have a rather large table which they maintain as a list for some sort of items (e.g. products). On certain pages however, they do not want to show the entire table, but e.g. only items with a certain keyword in a column.

That’s the use case for which the following filtering extension can be used. It adds another parameter filter to the Shortcode that gets passed one or more search terms (connected with a logical operator):

[table id=1 filter="word1&&word2" /]

Then, only those rows of the table are shown, that have columns that exactly match the search term(s). In the example, only rows where one column has the exact value “word1″ and one column has the exact value “word2″, will be shown.

UPDATE for WP-Table Reloaded 1.9: Please see the note below the code, regarding the deactivation of the “Cache Table Output” feature!

Let me start with some thanks first: This extension has been made possible by the kind donations or support of Peter Miller, Paulo Correia, PJ Scheufele, Wei-Ni Chong, and Sjoerd Jongerius. Thanks to all of them!

To get started with WP-Table Reloaded Extensions, you should read the introduction and follow the included instructions. You will also find links to the other presented Extensions there.

Now lets come to the actual code of the Extension:

/**
 * Show only rows that match the "filter" parameter value/contained logical expression
 */
function wp_table_reloaded_filter_rows( $output_options, $table_id, $table ) {
    // early exit if no "filter" parameter given
    if ( empty( $output_options['filter'] ) )
        return $output_options;
 
    $filter = $output_options['filter']; // from the Shortcode parameter "filter"
 
    // && is the passed value for &&
    if ( false !== strpos( $filter, '&&' ) ) {
        $compare = 'and';
        $filter = explode( '&&', $filter );
    } elseif ( false !== strpos( $filter, '||' ) ) {
        $compare = 'or';
        $filter = explode( '||', $filter );
    } else {
        $compare = 'none'; // single filter word
        $filter = array( $filter );
    }
 
    foreach ( $filter as $key => $string ) {
        // remove HTML entities and turn them into characters, escape/slash other characters
        $filter[ $key ] = addslashes( wp_specialchars_decode( $string, ENT_QUOTES, false, true ) );
    }
 
    $row_match = false;
    foreach ( $table['data'] as $row_idx => $row ) {
        if ( 0 == $row_idx && $output_options['first_row_th'] )
            continue;
 
        $found = array();
        foreach ( $filter as $key => $string ) {
            $found[ $key ] = in_array( $string, $row );
        }
 
        switch ( $compare ) {
            case 'none':
            case 'or':
                if ( in_array( true, $found ) ) // at least one word was found / only filter word was found
                    $row_match = true;
                else
                    $output_options['hide_rows'][] = (string)$row_idx;
                break;
            case 'and':
                if ( ! in_array( false, $found ) ) // if not (at least one word was *not* found) == all words were found
                    $row_match = true;
                else
                    $output_options['hide_rows'][] = (string)$row_idx;
                break;
        }
    }
 
    // if search term(s) was/were not found in any of the rows, all rows need to be hidden
    // but only if first row is used as table head
    if ( ! $row_match && $output_options['first_row_th'] ) {
        $row_idx = 0;
        $output_options['hide_rows'][] = (string)$row_idx;
    }
 
    return $output_options;
}
 
/**
 * Add "filter" as a valid parameter to the [table] Shortcode
 */
function wp_table_reloaded_shortcode_parameter_filter( $default_atts ) {
    $default_atts['filter'] = '';
    return $default_atts;
}
 
/**
 * Register necessary Plugin Filters
 */
add_filter( 'wp_table_reloaded_frontend_output_options', 'wp_table_reloaded_filter_rows', 10, 3 );
add_filter( 'wp_table_reloaded_shortcode_table_default_atts', 'wp_table_reloaded_shortcode_parameter_filter' );

The code form above just needs to be copied into the file “wp-table-reloaded-extensions.php”, created according to these instructions (after the Plugin Header comment, but before the closing PHP bracket ?>).

ATTENTION: One additional change is required (since WP-Table Reloaded 1.9): You must turn off the “Cache Table Output” feature in the “Table Styling Options” section on the “Edit” screen of the table! Otherwise you will get the same filtering result on all pages where the table is shown.

Then, just activate the new plugin “WP-Table Reloaded Extensions”, if you haven’t. That’s it! :-)

I commented the code so that it should be easy to understand, but here’s short walkthrough: The Extension hooks into the WP-Table Reloaded code to register a new Shortcode parameter filter. That is necessary so that the actual value passed with that argument is available to the actual filter algorithm. That algorithm starts with determining, what kind of filtering is wanted (“and”, “or”, or just one word). It then extracts the search term(s) and searches the row for them. Then the actual condition is checked, and if it is not fulfilled, the row will be marked as hidden from the output. There are some minor sanity checks around that (i.e. the first row needs to be treated differently or there needs to be a fallback, if all rows would be hidden), but basically that’s how the code works.

Here are a few examples that show the three possibilities for using it (remember that in all cases, exact matches to the cell content are required, i.e. if you search for “test”, but the cell content is “testing”, that will not match!):

Search for a single word in a row:

[table id=1 filter="word1" /]

(All rows that do not have “word1″ as the content of at least one cell will be hidden.)

Search for at least one word:

[table id=1 filter="word1||word2" /]

(All rows that do not have either “word1″ or “word2″ as the content of cells will be hidden.)
You can combine as many search terms with || as needed.

Search for all words:

[table id=1 filter="word1&&word2&&word3" /]

(All rows that do not have “word1″ and “word2″ and “word3″ as the content of cells will be hidden.)
You can combine as many search terms with && as needed.

Important: Mixing the logical operators is not possible though, i.e.

[table id=1 filter="word1||word2&&word3" /]

will not work!

So, you are now able to only show the necessary parts of a large table :-)

If you like this series of Extensions, I’m happy about any feedback, and especially about further suggestions!

Previous posts in this series that might interest you:

57 comments

  1. AlphaGolf says:

    Hi Tobias,

    Many thanks for your work and time, and congratulations for the result!

    A couple of features that I’m missing with WP-Table Reloaded: First is the ability to print the result of a search. I’m currently using WP-Print to print the content of a post or a Page, but unfortunately in the case of this specific Page, it prints the whole table, as found with the shortcode I’ve entered in the Page content. Same thing applies for WP-Email (from the same author, BTW).

    Secondly, I’d like to put on the public part of the blog (wp-content, that is), a button or anything else that allows readers (with or without specific rights) to export the content of the table or the result of their search, in CSV or as a PDF file (with header/footer).

    Maybe ideas for future Extensions lessons?!

    All best,
    AlphaGolf

    • Tobias says:

      Hi,

      which Search are you actually refering to, here?
      The filtering from this extension or the Search with the text field that is shown above the table?

      For both of your questions, you might want to look into the TableTools extension to DataTables. You can see a demo here. To turn it on, select “DataTables+TableTools” in the “Plugin Options” and then enable the usage for it on the table’s “Edit” screen. You will then have the new buttons for printing and exporting to Excel.

      Best wishes,
      Tobias

      • AlphaGol says:

        Hi Tobias,

        Thanks for your answer, functionally this is exactly all I need. The only drawback is that my 2000-entries long table is loaded in full before being filtered, it is veeeery slow and may even lock the computer for a small while…

        One more question regarding this article, and your conclusion “you are now able to only show the necessary parts of a large table”. Maybe I’m dumb, but how do I access the hidden fields in this case?

        All best,
        AlphaGolf

        • Tobias says:

          Hi,

          thanks for the confirmation. TableTools is really nice, yes!

          For the slowness: There have been fixes and improvements to the DataTables library that should make the filtering/sorting faster with such large tables. I’ll incorporate the new version into WP-Table Reloaded 1.7, scheduled for release this weekend and currently available in beta. If you want, you can try it out.

          For your second question: You can’t access the hidden fields with this. That’s the purpose of this extension :-) It has a main difference to the filtering that is performed by the DataTables library: It filters from all rows that are on the server and only delivers the filtered data to the browser, while the DataTables library filters on all the data it gets, i.e. that is sent to the browser.
          They work completely independent and have different use cases.
          (I will however present an extension in the near future that does an initial filtering on the table using the DataTables library.)

          Best wishes,
          Tobias

  2. Paulo Correia says:

    Hi Tobias,

    A small minor enhancement: Exact search or not :)

    Let me explain: When I search in the Search field above the table, the search is performed with every keystroke.

    When use the extension, only exact search is performed. Is it not possible to change this beavior?

    • Tobias says:

      Hi Paulo,

      thanks for the reminder.
      I had actually planned to add that to the extension, but have not yet found the time.

      It is pretty simple to do actually. All you need to do is extend the line

      $found[ $key ] = in_array( $string, $row );

      a little bit.
      Instead of checking the row content with in_array(), you just need to loop through the row cells and search for the search word with stripos().

      Best wishes,
      Tobias

  3. Matt says:

    Hello Tobias,

    First, your plugin is outstanding. It works as advertised and is the only tool I’ve found that does what it does. Please keep up the good work.

    I’m using your plugin to store contact information for a searchable directory. The table contains a column of data that I would like to display for users, but exclude from the search function, i.e, “search all cells except for those contained in column X.”

    It seems like there might be a way to use this extension to do this. Any suggestions would be welcome.

    Matt

    • Tobias says:

      Hi Matt,

      thanks for your comment.

      Just to clarify: With search function, you mean the textfield directly above the table that does the real-time search? Or do you mean the regular WordPress Search function that delivers a list of posts/pages?
      I’m assuming the first one here.

      In that case, this extension is not what you need. The extension will perform a filtering before the table is shown on the page. So actually the column would not be visible to the user – which is not what you want.

      Instead, you are looking for the bSearchable parameter of the DataTables JS library (which is responsible for the sorting and searching).
      Using it is pretty easy with the “Custom Commands” textfield in the “DataTables JavaScript Features” section on the “Edit” page of your table.
      Into that field, you’ll just have to enter a line similar to

      "aoColumns": [ { "bSearchable": false }, null, null, null, null ]

      It does however need a slight adjustment to your actual table: The number of elements between the [] brackets needs to be same as the number of columns in your table. All columns that shall not be searchable, get the "bSearchable": false, while all other ones get a null. So in my example above, the code would be for a table of 5 columns, where the first one would not be included in the search.

      Just adapt that to your needs and you should be fine :-) More on this can be found in the DataTables docs for this, which I linked above.

      Hope this helps :-)

      Best wishes,
      Tobias

  4. Zack says:

    I have created the wp-table-reloaded-extensions.php and put it in the /public_html/wp-content/plugins location. I have also activated the WP-Table Reloaded Extensions plugin. I have checked the “Yes, use the “DataTables” JavaScript library with this table.” in my tables options. I have checked the “Yes, enable the use of a JavaScript library. ” box and selected “DataTables+TableTools” option. After all this, I cannot see any search box to interact with my table, what am I missing?

    Actually when I change my table call from [table id=2 /] to [table id=1 filter="word1" /] or any of your other examples, my table disappears. Help me!

    • Tobias says:

      Hi Zack,

      ok, it looks like you are mixing things up here a litte :-) The Filtering extension has nothing to do with the Search box that you are trying to get. The Filtering Extension performs a search prior to the table being shown on the page, while the Search field will do a live search.

      From your description, it sounds like that your theme’s footer.php file does not have a call to wp_footer(); included.
      Could you check that?

      Also, it would help, if you could provide the URL of the page with the table.

      Best wishes,
      Tobias

      • Zack says:

        I believe my theme’s footer.php does have that call, I don’t know if it’s placement is okay. See the code below.

        [Code stripped]

        Also here’s my page
        http://www.enjoyutahoutdoors.netii.net/?page_id=10

        • Tobias says:

          Hi Zack,

          thanks for your follow-up.

          It seems that your code was stripped from the comment by WordPress (some precautionary security messure), but that’s not a problem actually. From the link to your table I can see that the wp_footer(); call is correct.

          Unfortunately I don’t yet see a reason why it’s not working for you. It might be either a conflict with your theme or with another plugin. Therefore: Could you temporarily switch to the WordPress Default theme and check if it works there? That would confirm that it is a problem with the theme.

          Best wishes,
          Tobias

          • Zack says:

            I tried it with the default WordPress 1.6 theme with the same result, no search box. Any other ideas?

          • Tobias says:

            Hi Zack,

            ok, then it seems to be a problem with another plugin, i.e. a plugin that is also using jQuery/JavaScript on the frontend. Very likely, the code then creates a conflict.
            Can you try deactivating your other plugins one by one and check if the Search box appears? Don’t forget to clear your browser’s cache each time.

            It would also be helpful, if you could provide the URL of the page with the table.

            Best wishes,
            Tobias

  5. Matt Vivion says:

    Hello Tobias,

    This extension makes it easy to filter data from a single table. But is there a way to use it to display data from two tables with different table IDs as one table (so long as they have the same entries in the header row) for users?

    I ask, because I am gathering the same set of data from two different work groups, but I want all of the data searchable in a single table on the shared website for both work groups. I’m guessing I can’t just list all of the individiual tables in a single Shortcode where I want it to display, like this:

    [table id=1,2 /]

    I would like to do this so I can have two different people update two different tables with data that shows up in one place. I could just let both people update a single table and filter accordingly if I wanted to display specific data for each work group, but the risk there is that the people would update the table at the same time and overwrite each other’s work. There is no “this file is being revised” warning as far as I can tell, so I’d prefer to keep the data in separate tables on the backend, but display as one table on the frontend for website visitors. I hope this makes sense.

    Matt

    • Tobias says:

      Hi Matt,

      thanks for your comment. Nice that you like the extension!

      Your question is tough one. Unfortunately what you are trying to achieve is not possible with the plugin, by default.

      After reading the first parts, I though that I can suggest using a single table and then just filtering as needed to get the single views.
      However, you presented a very legitimate reason on why this would not work in your case. You are right, there is no way to “lock” a table currently. (That’s a cool suggestion though, that I will take a deeper look at.) A really ugly hack could be to temporarily disable the other person’s WordPress account, but that is not really an option I guess.

      It might however be possible to achieve what you want with a custom WP-Table Reloaded Extension. It could imagine that we could “abuse” the load hook for an imaginary/dummy table and instead of returning its (dummy) content, just load your two tables, merge them, and return that as the content of the dummy table. Does that make sense? I don’t know though if it would work or how much work it would be, but some programming would be required. Unfortunately this is not something for which I can provide free support, as you can hopefully understand. If you are however interested in a custom solution, we can maybe work something out, in which case I suggest that you contact me by email.

      Best wishes,
      Tobias

    • Tobias says:

      Hi Matt,

      I just thought of a second possibility that could be used to achieve what you need.
      It would be possible to create a new Shortcode (like [combine-table id=”1,2″ /] or something like that), which would (internally) use the WP-Table Reloaded Template Tag functions to obtain the content of the (single) tables and could then do some string manipulation to combine both (or actually even more) tables into one large one.
      This should work nicely might even requirer less programming as my other suggestion. However, you might lose some flexibility in the table features, which is caused by the then inconsistent CSS classes. For example, you could not easily style individual rows differently (but you probably don’t need that anyway).

      Best wishes,
      Tobias

  6. Beau says:

    Hi Tobias,

    First I would like to say that this is the best, most well thought out plugin for WP that I have ever used. I think the Extensions are absolutely fantastic. I wish I had money to donate to support this great work. When I do, I will!

    I really like the idea of being able to filter a larger table to show only the desired elements.

    I have a few questions:

    I have a product site and would like to be able to compare multiple products, and render to an article for readers to use.

    I see that this Extension should enable just that.

    But, I would also like to be able to offer comparisons based on user input. Would something like this be possible? And how would I go about passing user input to WP-Table Reloaded, so that users are able to compare products side by side?

    Most product comparisons that I have seen, use check boxes, to record user input.

    I see that HTML entities are stripped – not sure exactly what this means. But would this function remove links?

    I hope I have been clear.

    Thanks for the great work and your help.

    • Tobias says:

      Hi Beau,

      thanks for your comment. Good to hear that you like the Extensions :-)

      Regarding those comparisons: There’s nothing speaking against it, it does require some work however:
      Mainly, you would need to get those input values and generate a call to WP-Table Reloaded from them.
      This means that you need to create an HTML form with checkboxes and a submit button. When the form is submitted, you will be able to access the values from the checkboxes from within PHP. There, you’ll need to transform those values into a legitimite call of WP-Table Reloaded, which means calling the function wp_table_reloaded_print_table() with a query strings of arguments (which basically are the same as for the Shortcode, see the docs here).
      I would do that in a “page template” file, which your comparison page then uses.

      Now, one thing I foresee as problematic: A product comparison usually has the products in the columns, and their respective properties in the rows. So, the filtering Extension from this page is not really useful there. Instead, you’ll need to use “show_columns” parameter, maybe.

      About the “HTML entities are stripped”: What do you mean with that, i.e. where have your read that? Don’t really know what you are refering to with that.

      Best wishes,
      Tobias

      • Beau says:

        Hi Tobias,

        Thanks for the response. I figured it would be a bit complex.

        Now that I know it is possible; maybe when I am ready I can contact you about a paid custom extension development.

        Here is the note from the first “foreach” entry in the above script:

        // remove HTML entities and turn them into characters, escape/slash other characters

        I just was not sure about what HTML entities are, and whether or not stripping them would cause HTML links to be removed.

        Beau

        • Tobias says:

          Hi Beau,

          thanks for your follow-up.

          I can’t promise anything right now, but depending on my time then (busy with work and university at the moment), I’m sure glad to work out something custom with you.

          For the HTML entities: Oh, ok, now I know what you mean :-)
          No, don’t worry, this will neither remove any HTML from the table cells nor any HTML links. HTML entities are things like   or &, which just need some extra treatment in the Extension. That code does not influence the actual content or output of the table though.

          Best wishes,
          Tobias

          • Beau says:

            Excellent!

            I won’t be ready for a month or two. It’s tax time here in the U.S., and Uncle Sam wants his due. I’ll drop you an email, when I am ready, to see what your schedule is like. And we will work something out.

            Beau

  7. Luke says:

    Greetings from Overland Park, Kansas, Tobias!

    I have actually stayed a week in Magdeburg, when I was researching my family tree a decade ago. We could actually be related, and you do in fact look a lot like my brother! ;)

    Anyway, I wanted to take a moment to tell you that this plugin is awesome. Thank you so much for taking so much time out of your life to create and upkeep it, many of us obviously appreciate it.

    My one tiny question for you is about the data loading sequence…

    If I run a large database, let’s say 50 columns by 2000 rows of text entries, but I limit a page in WordPress to display only 10 of those columns at a time, does WordPress still have to take the time to churn all of the data and then just display the 10 columns, or does it only actually request the 10 columns from the mysql DB in the first place?

    Thanks again,
    Luke in OP

    • Tobias says:

      Hi Luke,

      thanks for your nice comment! I hope you liked it overhere in Magdeburg :-)

      Regarding your question:
      Yes, WordPress will load the entire table, before performing the filtering. The reason for this is the data structure that I use. A table is stored as a serialized two-dimensional array in a single row of the “wp_options” table. This means that it is not possible to select values from it with SQL commands. Rather, the entire row (with the table in it) is retrieved and then PHP does the filtering.
      I don’t know any numbers, but depending on your server’s ressources and the real size of your table, you might get into performance trouble here. Not really on the loading/filtering, but on the “Edit” screen of the table: You would then have over 10000 textfields for the entries, and that is very likely going to break down your webbrowser.
      So, for such large tables you might be better off with a custom PHP/mySQL solution. My plugin was designed for smaller tables (although larger ones do work, but might have issues. So I’m not giving any guarantee that it works for your table. :-) ).

      Best wishes,
      Tobias

  8. Luke says:

    Yes, Magdeburg was a great experience. Everyone there was so nice and helpful. It was also very eye-opening for an American how different society was structured (such as driving laws and how your cemetery plots were not permanent), but it seemed to work even better (like a well-oiled machine), compared to our laws and customs here. We could really use a lot of what Germany has to offer here in the USA. Luckily Obama is in the White House, so we’re slowly headed that way now.

    Anyway, you figured me out, the slow load time on the “Edit” screen was exactly what was happening. Even worse, I tried to get my hosting provider (shared hosting) to edit that suhosin.ini file, but they said it was not in use on their server at all. :(

    Sadly, I think I’m going to have to settle for Zoho docs on this one, as I was planning for the table to get much bigger in time. It is a shame, your plugin was perfect for my needs in every other way.

    Please let me know one day if you’ve found a way to overcome this limitation.

    Cheers,
    Luke

  9. Ton de Gier says:

    Hi Tobias,

    Again, your WP-Table Reloaded plugin is fantastic.
    I use the filter extension you made before and used another parameter “filter_on” which filters on a specific column. I think this option is better than without.

    I need an option to avoid redundent table content.
    Therefore, I want to make a query to display the result of one or more tables.
    Is this possible with this plugin?

    Kind regards,
    Ton de Gier

  10. Gary says:

    Hi Tobias, I have only recently started to use your plugin. I work as a WordPress consultant and therefore have come across many plugins. I have to say that this is the best plugin I have used. It is so incredibly powerful and simple to use. In addition, it is amazing how much time you have dedicated to providing extensions and support for the plugin. Thank you!

  11. Ovidiu Bica says:

    Hello and congrats on your extension.
    I was wondering if it is possible to include an option to hide/unhide a column based on a user’s state: guest/logged-in, or even better, based on a logged-in user’s permission.
    This is useful if you have a price list and only want to show the price to logged-in or certain users.

    • Tobias says:

      Hi,

      you can achieve this either with PHP in the cells (see my other Extension), where you make the check for the state of the user and either show the price or a log-in message.
      You could also achieve this with an additional Shortcode parameter, which could be set depending on the user’s state. This would require to either use PHP in a post/page to generate the correct Shortcode or you could use the Template Tag in a page template.

      Best wishes,
      Tobias

  12. simon says:

    Hello,

    this is a fantastic plugin, I use it already several months and it’s very easy to employ or to edit, congratulations!
    As I am trying to understand the working of it, I can’t find the tables where everything is kept. Normally one uses a table and an interface to connect to the table and look for a certain record. But here it’s big magic, I import a table and it works great, but where is the table? Maybe as a magician (LOL) you would not show the trick and I can understand it fully, nevertheless show me a little of your magic.

    Simon from Antwerpen, Belgium

    • Tobias says:

      Hi Simon,

      thanks for your comment!

      Don’t worry, no magic here :-) All tables that are created with WP-Table Reloaded are stored in the “wp_options” table, with keys like “wp_table_reloaded_data_N”. Tables are created as multi-dimensional arrays which are serialized to a string and then stored in the database. Because of that, no custom mySQL table is needed, but the available WordPress methods can be used.

      Best wishes,
      Tobias

  13. Stu says:

    Hi Tobias,

    I’m hoping this is the best place to put this. How would I go about implementing this: http://www.datatables.net/examples/api/multi_filter_select.html

    And ideally having the row of filters show up above the table, sandwiched in between the search bar and the table.

    • Tobias says:

      Hi Stu,

      thanks a lot for your question. This unfortunately is a very specific DataTables request. The best way to use this is to deactivate the usage of the DataTables library for the table in question in WP-Table Reloaded and then manually load DataTables with that plugin into your site.

      Best wishes,
      Tobias

  14. hbarrett says:

    Hello Tobias,

    Just wanted to stop by and say how much I love your plugin! It’s so easy, so intuitive and I just love using it. So much I just sent in a donation. Good luck with further development.

  15. damian says:

    Hi,

    Like your plugin, but was wondering if it is possible to make keyword drop-down menu?

    Let me explain. I have several most used keywords that users search the most. Now, I want to make (instead of regular type in search box) drop down menu with all my pre inserted keywords – user would not have ability to search by typing in anymore?

    Is this difficult to make, or just simple tweak?

    Thanks for advising,
    Damian

    • Tobias says:

      Hi Damian,

      thanks for your comment.
      This is not that easy unfortunately, or at least not without custom programming: You will need to replace the current input field with the drop down and then use the DataTables Filter API to perform the search. Please see the DataTables documentation at http://www.datatables.net for more.

      Best wishes,
      Tobias

      • Bob says:

        Hi Tobias,

        Great plugin. This feature has been difficult to find a solution for. Do you have any suggestions as to how I can find someone to create custom programming to create the drop down box filtering?

        • Tobias says:

          Hi Bob,

          thanks for your question. Unfortunately, I don’t have any direct sources or recommendations, but I suggest that you try either in the “Jobs” section of the WordPress.org forums (not sure if it still exists), or in the DataTables JavaScript forums (you might actually have better chances there, I assume).

          Regards,
          Tobias

  16. Brian Combs says:

    Ok, I’m having some weird behavior with this plugin extension.

    I’m using WP-Table Reloaded to manage a bibliography on my site, one row for each book. I then want to take a subset of these and include them on the Tag page for related tags.

    So, I created an additional column, hid it, and filled it with a unique code tied to the particular tag.

    It worked perfectly. I was then able to pull just two books into a particular tag page.

    Then, I started populating other tag pages, changing the code to match.

    When I checked, the second tag page I had populated had the books from the first one.

    I figured that I must not have changed the code. Nope, that was correct. It was pulling the wrong rows.

    Then I noticed that the main bibliography page was only showing the two books from the first tag.

    What the heck?

    At this point, I turned off the extension.

    The bibliography still only showed the two books from the first tag.

    Mind you, this is with the filter extension turned off.

    Forcing refresh in my browser didn’t help.

    Looking at it on a different computer showed the same problem. It was coming from the server, not a browser error.

    I was able to clear up the problem by changing the order of the columns, and then refreshing the page. I don’t know why that helped.

    Very strange.

    • Tobias says:

      Hi Brian,

      thanks for your comment. And sorry for the trouble you are experiencing, it is of course not your fault.

      This is what happens: You are bitten by the new “Table Output HTML caching” feature. This is actually a great feature, but for users who use the filtering Extension, it causes a little trouble. What happens: On the first load of the (filtered) table, that result is stored in the cache. All subsequent loads of the table will the get the table from the cache – without the possibility to take the new filter word into account.
      (The caching feature is on by default in WP-Table Reloaded 1.9.1, therefore this happened.)

      Fixing this is easy though: All you need to do is turn of the caching feature for your table, by unchecking the corresponding checkbox on the “Edit” screen.

      Best wishes,
      Tobias

  17. John says:

    Your plugin has been really useful. Thanks! Wondering if it is possible to filter more than one search term, e.g. if I want to find an items within a table that has two characteristics (like blue and round) that I can perform a search to find items that meet both criteria.

    • Tobias says:

      Hi John,

      yes, that is possible, as explained in the post, with examples…
      Or is that not what you mean?

      Regards,
      Tobias

  18. Michael says:

    Hello,

    Thanks for the nice plugin. I am trying to build a table where two actual rows make up a single “virtual” row. The two actual rows have a rowspan in the first column and a column span on the 2nd and 3rd columns of the second row. Together they are shown to the user as a single entry as kind of a virtual row.

    I would like to add many more virtual rows to the table without having to recreate each of them manually. I tried exporting the data to all three formats, hoping I could add additional virtual rows and then do an import. Unfortunately, even with a single virtual row the data import fails to recreate the table correctly. I assume it is because of the rowspan and colspan.

    Can you suggest a workaround to assist in the creation of a table with many of these virtual rows that are really made of two rows each (containing a rowspan and colspan).

    Thanks greatly,
    Michael

    • Tobias says:

      Hi Michael,

      thanks for your question.

      The rowspan and colspan features only work manually at this time, by using the keywords “#colspan#” or “#rowspan#”. You will either need to add them manually in the textfields on the “Edit” screen of your table, or you will need to add them manually to the file that you want to import in the respective places in the files. The plugin can not detect colspanned or rowspanned rows otherwise.

      Best wishes,
      Tobias

      • Michael says:

        Hi Tobias,

        In the exported HTML, the #colspan# and #rowspan# entries are present, but the import function does not recreate table with the correctly spanned column and row (different rows/columns are spanned).

        Is there a different placement of these keywords required to get the import to properly recreate the table?

        Thanks again,
        Michael

        • Tobias says:

          Hi Michael,

          if I understand correctly, you are experiencing that importing an exported table results in a different table than before? I can’t really see how that should happen…

          Can you email that HTML file with the table to me, as well as a screenshot or link of the original table (i.e. how you expect the imported table to look like)?

          Thanks!
          Tobias

  19. Martin says:

    Hi Tobias,

    you might want to add a note on the filter extension that the new caching function needs to be disabled if a table uses filtering.

    Otherwise you will always get the result of the first call to the filter on subsequent calls.

    Or you need to update the caching or the filtering functions. ;-)

    Martin

    • Tobias says:

      Hi Martin,

      thanks a lot for your reminder! I had actually planned to do that, but for some reason, I forgot again…

      Regards,
      Tobias

  20. Simone says:

    Hi there,
    Love the plugin! What CSS is required to change the format of a single cell? I’ve been trying variants of the below with no luck. Obviously, I’m trying to bold and underline text in one cell.
    Thanks!

    • Tobias says:

      Hi Simone,

      thanks for your comment. Your try was almost correct: You just need to use numerical indexing in the columns as well, and the td at the end is too much, as the “.column-1″ is a “td” already.
      Please try this:

      .wp-table-reloaded-id-6 .row-12 .column-1  {
         font-weight: bold;
         text-decoration: underline;
      }

      Best wishes,
      Tobias

  21. Hugo says:

    Hi Tobias,

    Thank you for your plugin and will be installing and using it soon.

    Meantime, desperately required your guidance on how to do the following:

    Had a database for a site that was damaged by the webhost when they backup their system or something.
    I had to upload and another old database to replace the damaged one.

    1. Database size is over 400MB – how do I import such a huge dump into the database?
    Using bigdump – it kept meeting with some sort of errors mid way through – mostly from users posts in the dump file.
    How can I successfully import and how to solve the errors so that I can continue to complete the import?

    2. Being a old database, have forgotten my password used for wp-admin login. Where and How do I change/insert a new password in the database?

    3. How and where in the database, can I change also the site’s domain name so that the database can be used for the current domain name?

    Your kind assistance with your solutions/guidance of the above – by return email, would be much appreciated.
    To repay your kindness, I am more than happy to make a donation.

    Please help me and thank you in advance.

    Regards,
    Hugo

    • Tobias says:

      Hi Hugo,

      thanks for your comment.

      Unfortunately, I’m not really able to help with this, as the WordPress database is not something I know very well.

      Everything you mention should be possible more or less easily.
      The import will be the biggest task. For that, you should try to split the database dump into several smaller pieces and then import them through the database access tools of your host (like PHPMyAdmin).
      For details, I however suggest that you ask in the WordPress forums at http://www.wordpress.org/support.

      Best wishes,
      Tobias

      • Hugo says:

        Hi Tobias,

        I appreciate your taking time to respond. Thank you.

        Per your advice, I will try to seek help in the WP forum and hopefully someone will come forward to provide me with the solutions.

        Once again, thank you and best wishes.

        Regards,
        Hugo