fabiokbca
Posts: 18
|
Posted: 02/03/2012, 3:28 AM |
|
Hi guys.
How to make a grid builder display dates only after the research?
|
|
|
mamboBROWN
Posts: 1713
|
Posted: 02/10/2012, 6:17 AM |
|
fabiokbca,
We need more information. When you say..."display dates only after the research?" can you be more descriptive or give an example.
|
|
|
fabiokbca
Posts: 18
|
Posted: 02/10/2012, 9:27 AM |
|
Ok mambo brown.
I need hidden grid rows.
Display data*(my mistake) only after execute search action.
On load of page i need my grid without rows.
|
|
|
andy
Posts: 183
|
Posted: 02/15/2012, 12:52 PM |
|
As a suggestion, you could use the grid's BeforeSelect event.
Test to see if there are any search parameters being passed in the URL
If yes, do nothing (allow the search to filter the grid data appropriately)
If no search parameters i.e. the grid with all data prior to a search, then modify the DataSource
For example, assuming one of your search parameters is "surname":
function MyGrid_DataSource_BeforeBuildSelect(& $sender) {
global $MyGrid;
global $searchString;
$searchString = CCGetParam("surname","");
if ($searchString == ""){ // in other words no search parameters
$MyGrid->DataSource->Where .= " AND (someimpossiblecondition = someimpossiblevalue)";
}
I haven't tested this code and you will not only have to adapt it but will probably have to test for all of your parameters, but it might at least put you on the right track...
_________________
Andy
RAD tools for rich UI controls:
http://www.koolphptools.com |
|
|
clahti2
Posts: 107
|
Posted: 02/15/2012, 9:51 PM |
|
A bit more compact code:
global $MyGrid
if (CCGetParam("some_required_searchfield","") == "") {
$MyGrid->DataSource->Where = "WHERE 1=2";
}
The minor difference here compared to Andy is that there may be no WHERE clause to begin with, so appending " AND ..." will result in bad SQL code Just replace the entire Where clause with a condition that is guaranteed to return no records.
|
|
|
clahti2
Posts: 107
|
Posted: 02/15/2012, 9:53 PM |
|
also looking at the poster's original question I am wondering if he meant to hide the date columns, not entire rows. If this is the case then you need to have update panels for each column which then can be shown or hidden in the Before Show Row based on CCGetParam("some_required_search_date","");
|
|
|
|