Filtering a Table

markbhai1

New Member
I have a table of tasks which I want to filter by the users id in most cases, but I also want to give the option of filtering by a different users id.

What is the most efficient way of doing this?

There appears to be a few options such as pre-filters, url filters and (possibly) filtering via a dropdown list?

Thanks

Mark.
 
Hmmmm.

I think you could do it this way (untested, though):

Make the userid element in your tasks table be a database join dropdown, linking to the jos_users table (key being userid, value being username). Give it a default value of {my->id}. Also set 'Create table filter for this element', type dropdown, exact matches.

Then create a table pre-filter for the same element, field 'userid' (or whatever you called the element above), condition "EQUALS", value "{my->id}' (no eval), apply to whatever level you want (remembering that the level you set is the level at which the filter is no longer applied, so if you select Administrator, only people below admin level get filtered). And most importantly, 'overridden by url filter'.

I think this will then filter the table by the logged on userid by default, but provide dropdown to choose another user to filter on, which will hopefully then override the pre-filter.

-- hugh
 
Cheers Hugh,

I know that I am getting better at understanding Fabrik, when I have already done 50% of what you suggest because I thought it should be done that way!

I will test this later and let you know the outcome.

Thanks

Mark.
 
Good Try - but no luck.

Oh well.

I set everything up as suggested but the idea falls short when setting the default for the table filter.

It comes up with 'Please Select' in the 'Owner' dropdown and the table shows all records.

Thanks

Mark
 
Any Ideas Rob?

Hi Rob,

The above solution (as I am sure you will know) appears to filter both the table and the dropdown list to the contents of the WHERE statement, so once I have the filter effective it just allows me to select the signed in user. (If the filter is not effective then I can see all users).

Can you think of a way I can achieve my goal?

Thanks

Mark.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top