Jean-Christophe Michel | 2 Dec 2004 16:58
Favicon

Re: Browsing and filtering results in Table

Peter Cruickshank wrote:
> OK, I've got the hang of how to use the Table class to present lists of 
> data with optional sorting.
> 
> My next task is to filter the data that is being presented. By filter 
> here, I mean restrict items to those which fall within a date range, or 
> match a certain pattern. I've played around with adding a Form to handle 
> that side of things and it seems the way forward, but it would be good 
> to have some hints on ensuring that the filtering constraints are added 
> to the pagination and sort links.
> 
> I think the approach seems to be the search form sets parameters in the 
> table node, specifying the restrictions. The table node then uses them 
> to restrict the search done by the dataprovider, and somehow (through 
> query_prepend?) tells the smarty paginator to add the extra information 
> to the links it generates.

Why not store the search entry in session, so you keep it without 
passing it via GET ?
I must admitt I didn't have to do such filtering, but I will soon have 
to. I'll post my solution then.

--

-- 
Jean-Christophe Michel
Peter Cruickshank | 2 Dec 2004 18:23

Re: Browsing and filtering results in Table

On 2 Dec 2004, at 15:58, Jean-Christophe Michel wrote:

> Peter Cruickshank wrote:
>> OK, I've got the hang of how to use the Table class to present lists 
>> of data with optional sorting.
>> My next task is to filter the data that is being presented. By filter 
>> here, I mean restrict items to those which fall within a date range, 
>> or match a certain pattern. I've played around with adding a Form to 
>> handle that side of things and it seems the way forward, but it would 
>> be good to have some hints on ensuring that the filtering constraints 
>> are added to the pagination and sort links.
>> I think the approach seems to be the search form sets parameters in 
>> the table node, specifying the restrictions. The table node then uses 
>> them to restrict the search done by the dataprovider, and somehow 
>> (through query_prepend?) tells the smarty paginator to add the extra 
>> information to the links it generates.
>
> Why not store the search entry in session, so you keep it without 
> passing it via GET ?
> I must admitt I didn't have to do such filtering, but I will soon have 
> to. I'll post my solution then.

Thanks. I ended up going for a GET-only solution (once I'd sorted the 
bug in Form), with a form node to handle the changes in parameter. The 
advantage is that the results are then bookmarkable by the users (which 
I guess might or might not make sense, depending on the circumstances).

My solution involves the form node using submitted values or the query 
parameters to tell its sister result-listing node (based on the table 
examples) what the constraints are. The constraints are then passed to 
(Continue reading)

Jean-Christophe Michel | 2 Dec 2004 18:52
Favicon

Re: Browsing and filtering results in Table

Peter Cruickshank wrote:
> I'm sure there are more elegant approaches out there... it would be good 
> at least to know if there's anything that doesnt fit with the 
> Binarycloud Way.

You know, binarycloud is a framework. So it's probably able to do many 
things in many different ways ;-)
The more elegant the solution, the less code we have to write imo 
(reverse the proposal too).

PS: if you have a smart gallery script, maybe think to commit it in vortex/
--

-- 
Jean-Christophe Michel

Gmane