XF 2.2 After some advice on filtering data on my add-on

XboxUnlimited

Active member
Hi,

I have spend the last few weeks reading up how to create add-ons using new Entity/Controllers/templates to create a new custom page on Xenforo which I have now done.

The page seems to work and simply pulls my own custom data from the database and displays the contents on the page fine, but I would like to manipulate the data display by using some on page filters that can be clicked to filter for example as A-Z or Z-A etc things like that.

Can anyone advise how to do that or point me to some documentation or tutorials they may help as I'm struggling to find anything so far.

Thanks
 
Is the content displayed in a table?

I did something similar a while ago and used a third party library which allowed sorting on each column.
 
Is the content displayed in a table?

I did something similar a while ago and used a third party library which allowed sorting on each column.
Yes, that's correct, I have created a new table in the Xenforo database and created a new controller and entity and then use the $this->finder to display the data on the page, I thought there maybe someway of using the finder to filter out the data in different way directly on the page.. if that makes sense!!
 
Ahh sorry, no it’s not, I was planning on displaying it in a grid layout a bit like the article one and.having a side bar with the filter options… if that’s possible
 
In that case, you can implement something similar to how threads are filtered in a forum.

1646939828252.webp

Check through the code to see how that's achieved.
 
Just wanted to bump this as I'm not getting anywhere myself, I now have the add-on up and running here https://www.xboxunlimited.com/games/ without any filters

So as suggested I was going to look at how threads are filtered in a forum, check the code and try and work something out but I'm not sure where to start, any further suggestions or pointers would be appreciated. Thanks
 
at a marco level,

your form drives the query order by.

if it's name, z-a, your query would look like

... order by username desc


Make sure you use prepared statements.
 
Back
Top Bottom