WordPress.org

Ready to get started?Download WordPress

Forums

WP-Table Reloaded
[resolved] Love this plugin but search question (6 posts)

  1. footballperspective
    Member
    Posted 1 year ago #

    Love this plugin; probably the best one I have on my site. That said, one question. Can you search the individual columns/rows instead of the whole table?

    I have this table on my website that lists all college football games: http://www.footballperspective.com/ncaa-games/

    If I wanted to search for just the Vanderbilt games, for example, when I type in Vanderbilt, it brings up all the times that is typed into the table, as it should. However, in my case, I don't want it to bring up Vanderbilt when it is in the opponent column (col4), just the team column (col2). Any way to do this?

    One other question. If I search "Florida" it will pull up Florida St, South Florida, Central Florida, etc. Any way to exclude them via the search?

    Again, I understand why these are all happening, not a problem with the plugin at all. Just figured I'd ask!

    http://wordpress.org/extend/plugins/wp-table-reloaded/

  2. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    thanks for your post! Nice to hear that you like the plugin!

    Making the search function only search a specific column should be possible. According to the DataTables JS library's documentation, you will just have to add a small parameter to the JS call. In WP-Table Reloaded, you can add that command,

    "aoColumnDefs": [ { "bSearchable": false, "aTargets": [ "_all" ] }, { "bSearchable": true, "aTargets": [ "column-2" ] } ]

    to the "Custom Commands" textfield on the table's "Edit" screen.

    Unfortunately, I can't think of a solution for the "Florida" issue, sorry :-( This could probably only be changed by changed the Search field from a text input field to a drop down list with all teams (which is not possible very easily, but only with extended custom programming, as far as I know).

    Best wishes,
    Tobias

  3. footballperspective
    Member
    Posted 1 year ago #

    Thanks Tobias. Yes, and several of my readers have commented that they love that my tables easily paste into Excel.

    FWIW, your fix did not work. When I did it, typing any letter into the search box could clear the table (no results). But no worries, I think I am simply going to add the letter Q to the end of each team name in the team column, which should solve both problems (FloridaQ, Florida StateQ, avoids problem 2, and I'll leave the opponent column as is).

    Again, thanks for making this awesome plugin.

  4. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    hmm, weird...
    Can you please try again with

    "aoColumnDefs": [ { "bSearchable": false, "aTargets": [ 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 ] } ]

    Adding that "Q" won't really change anything, I think. Searching for "Florida" would also find "FloridaQ".

    Regards,
    Tobias

  5. footballperspective
    Member
    Posted 1 year ago #

    Very cool -- that time it did work, Tobias. I also modified the code to delete the '8' column so I could search by conference. I know nothing about coding but I figured that one out -- cool trick.

    My thinking with the Q was if I add a Q to the last letter of Florida, South Florida, Central Florida and Florida State, then searching for FloridaQ will get me only the Florida games, because... actually I guess it will only work to eliminate Florida State (which would be Florida StateQ, so searching for FloridaQ wouldn't bring them up); it would still bring up Central FloridaQ and South FloridaQ.

    Oh well. I'll have to think about this one. In any event, that fix worked! So thanks.

  6. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    nice to hear that this code worked! And even better that you figured out the way the numbering works!

    Now I understand your idea about the Q, but indeed, it won't really work for all entries as you describe... :-(

    Best wishes,
    Tobias

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.