Page 1 of 1

best way to filter a datagrid

Posted: Fri Nov 29, 2013 6:01 pm
by townsend
I've got a datagrid with a date column. Some rows have a date, and others have the date field as empty.

I don't want to display both the empty and populated fields at the same time.
So I have a couple of radio buttons set up to switch back and forth between views.

The problems is, what's the best way make some rows "not visible" based on the value of this 1 field?
Here's an example, by extracting the data to do a filter and then re-populating the table.

Code: Select all

put the dgText of grp "DataGrid" into tText 
put fld "Search field" into tSearch 
filter tText with ("*" & tSearch & "*") 
## or whereever you need the "wildcards" -> * 

set the dgText of fld "DataGrid" to tText 
Is there a better way to do this? Thanks-- appreciate the pointers.

Re: best way to filter a datagrid

Posted: Fri Nov 29, 2013 7:35 pm
by bangkok
I believe there is.

By changing the default behavior of the DG.

http://lessons.runrev.com/s/3527/m/data ... -to-a-cell

In the FillInData handler :

Code: Select all

on FillInData pData
   -- This message is sent when the Data Grid needs to populate
   -- this template with the column data. pData is the value to be displayed.

if XXXXXXX then set the text of me to pData

end FillInData
You have to try. But It might create empty lines.