Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    I suggest to use JavaScript for this, and then use that to search for the desired rows. Have you checked out the search/filter function that the DataTables JavaScript library (comes with WP-Table Reloaded) offers? Maybe that is already enough… Otherwise, you could try to extend it through the library’s API.

    Regards,
    Tobias

    Thread Starter suntower

    (@suntower)

    Thanks. Got it to work. The dataTables guy has some great examples.

    QUESTION: Although what I did works fine, I couldn’t figure out a way to hook into the dataTable object when it first -loads-. IOW: I could only get my filters to work if I issue an fnDraw() in the jQuery ready(). So I think the table is loading and -then- it is redrawing with my filter. Again, not a problem for my end-users BUT I’m concerned that if the table got much larger (400 rows) it would be slow. Any ideas on this?

    COMMENT For -whoever-…
    You have to make sure your JQuery/JS is loaded in the footer. Otherwise you get an alert msg (which is actually a great idea.)

    —JC

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    great that you found a solution!

    Instead of trying to hook into the existing dataTable object/call, just do everything manually. I.e. uncheck the “Use JavaScript library” checkbox for the table in question, and instead manually invoke dataTable() in your JavaScript code. That will give you full flexibility.

    Best wishes,
    Tobias

    Thread Starter suntower

    (@suntower)

    Good idea.

    Can you point me to where the code which ‘automatically’ invokes dataTable is loaded (if you check the box) so I see how the plug-in does it?

    Thanks,

    —JC

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    just take a look at the footer of the HTML code of the page with the table. You will see something like

    jQuery( '#wp-table-reloaded-id-1-no-1' ).dataTable(...);

    there, which is just a call to the DataTables functions, according to its documentation.
    Just copy that and add it to your manual code, which you can then modify as necessary.

    Regards,
    Tobias

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: WP-Table Reloaded] Add New Search Form To WP-Table’ is closed to new replies.