Jump to content

How can I implement a table filter that honors pagination?


Recommended Posts

We want to build a text filter into our listing tables. By this I mean a text box where the user can type in text, and then the table only displays records/categories where the entered text is a substring of the title of a record/category.

A basic version of this was easy to implement using just JQuery, but I can't find a way to search through results that are not displayed due to pagination, using only javascript. Let me know if there is a way to make the javascript-only solution work.

I found that the type of filter I'm trying to implement was in use in the AdminCP of my site (example: in the members area you can search/filter members by display name) , so I went and looked how it worked. It turns out that the tables with the filter built in comes from the PHP class \IPS\Helpers\Table\Custom, while the default listing template is passed an \IPS\Helpers\Table\Content object.

So I'm actually looking for a way to use the \IPS\Helpers\Table\Custom class instead of the \IPS\Helpers\Table\Content class. It would probably be possible to create an instance of the \IPS\Helpers\Table\Custom class on the template itself, but there is no way to prevent the initial \IPS\Helpers\Table\Content object from being passed into that template. If I created a \IPS\Helpers\Table\Custom object in the template, it would be very inefficient.

I know that the actual creation of the involved \IPS\Helpers\Table\Content object happens within a controller in the \IPS\cms code, and I'm not sure if there is a way to override just that method.

So now I would like to know: Is there a way to change what is being passed into that template?


Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...