Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE » How To » Column Filter
Column Filter [message #2434] Wed, 03 February 2010 10:50 Go to next message
gpatti is currently offline  gpatti
Messages: 283
Registered: August 2008
Senior Member
I'd like to try and implement a column filter but not sure how it might be achieved within the framework.
I have a standard list2 screen and would like the user to be able to filter the rows displayed without having to go to a search screen, by selecting a value from a dropdown - almost like an extension to the functionality described in FAQ72 (i.e. a dropdown rather than a button).

In a perfect world this functionality might be built into the oolumn heading via a config setup (idea for an enhancement maybe?)

Is the basic function possible within the existing framework somehow?
Re: Column Filter [message #2435 is a reply to message #2434] Wed, 03 February 2010 18:39 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2370
Registered: April 2006
Location: Surrey, UK
Senior Member
Attached is a screen shot of a task I have written wich sounds like it does something close to what you describe. It has an outer (top) and an inner (bottom) entity, and the top entity is used to specify the search criteria which is passed to the bottom entity when the SUBMIT button is pressed.

In order to have a SUBMIT button it uses the MULTI4 pattern instead of the LIST2. The top entity is a dummy entity in that it does not retrieve or update anything in the database. This is achieved by:

(a) this code in the _cm_pre_getData() method
$this->skip_getdata = TRUE;

(b) this code in the _cm_pre_updateRecord() method
if (empty($this->errors)) {
    // there is nothing to update
    $rowdata = array();
} // if

The complete contents of the top entity will be made available in the $fieldarray argument of the _cm_pre_getData() method of the bottom entity. This will allow you to use that information to construct the sql statement before any data is retrieved. You will also need to return an empty array from the _cm_pre_updateRecord() method of the bottom entity so that no database update takes place.

Try it out and see how you get on.
  • Attachment: multi4.png
    (Size: 17.09KB, Downloaded 1197 times)


Re: Column Filter [message #2436 is a reply to message #2434] Wed, 03 February 2010 19:01 Go to previous messageGo to next message
gpatti is currently offline  gpatti
Messages: 283
Registered: August 2008
Senior Member
I'd spotted this in the FAQs but wasn't sure how you had done it. I'll play around with the information provided and see what I can do.

I'm just a little unclear about the 'dummy' entity part. I have real data showing from the parent entity. How do I add the filter fields as well? Do I just add them to the fieldspec of the parent somewhere?

Re: Column Filter [message #2437 is a reply to message #2436] Wed, 03 February 2010 19:36 Go to previous message
AJM is currently offline  AJM
Messages: 2370
Registered: April 2006
Location: Surrey, UK
Senior Member
A 'dummy' entity is one where there are no database reads or writes, but you can retrieve data from the database if you want to. Although an attempt will be made to update the database, if the $fieldarray is empty then the update will be skipped.

You can modify the contents of the $fieldspec array in the _cm_changeConfig() method. This is where you specify any new fields and their controls.


Previous Topic: Formatting in _cm_listView_header() method
Next Topic: check box
Goto Forum:
  


Current Time: Tue Nov 26 16:09:42 EST 2024

Total time taken to generate the page: 0.00917 seconds