Hi,
All is in title... I think i have to use save to session but how to make the difference if first request? with switch?
thanks
All is in title... I think i have to use save to session but how to make the difference if first request? with switch?
thanks
Hi Christophe,
Let's say the filter submits the data to the "index" event, then in the "index" event call a switch function, the data provider should be:
The values setup:
And the where conditions should be actually set to red from the session variable.
Best regards,
Max
Let's say the filter submits the data to the "index" event, then in the "index" event call a switch function, the data provider should be:
{data.empty:filter_field_name}
The values setup:
false:{session.set:my_filter$(data:filter_field_name)}
true:{session.clear:my_filter}
And the where conditions should be actually set to red from the session variable.
Best regards,
Max
Hi Max,
filter is a dropdown named select_sg
values selected
{session:filter_sg}
in read_data conditions fonds.sg_id:{session:filter_sg}/-
the switch switch_filter_sg
{data.empty:select_sg}
false:{session.set:filter_sg$(data:select_sg)}
true:{session.clear:filter_sg}
in the index and view views I put <p>Filtre {session:filter_sg}</p>
the filter_sg is correctly passed to the view, and when i click to go back to the list(index), the filter_sg is always informed but the dropdown and list are not up to date with the filter_sg
Something miss?
I think I need a second witch on session var for the true result of the first ?
Regards
filter is a dropdown named select_sg
values selected
{session:filter_sg}
in read_data conditions fonds.sg_id:{session:filter_sg}/-
the switch switch_filter_sg
{data.empty:select_sg}
false:{session.set:filter_sg$(data:select_sg)}
true:{session.clear:filter_sg}
in the index and view views I put <p>Filtre {session:filter_sg}</p>
the filter_sg is correctly passed to the view, and when i click to go back to the list(index), the filter_sg is always informed but the dropdown and list are not up to date with the filter_sg
Something miss?
I think I need a second witch on session var for the true result of the first ?
Regards
Hi Christophe,
The switch function is called BEFORE the read data and the listing/filter view in the event ?
Best regards,
Max
The switch function is called BEFORE the read data and the listing/filter view in the event ?
Best regards,
Max
Hi Christophe,
It looks like the switch function will not be enough here, a PHP function will be needed to check if the "data" value of "select_sg" is present and is empty to clear it.
Best regards,
Max
It looks like the switch function will not be enough here, a PHP function will be needed to check if the "data" value of "select_sg" is present and is empty to clear it.
if(isset($this->data["select_sg"])){
if(empty($this->data["select_sg"])){
\GApp::session()->clear("filter_sg");
}else{
\GApp::session()->set("filter_sg", $this->data["select_sg"]);
}
}
Best regards,
Max
Hello Max,
I put it just before the switch in index view and nothing. The filter_sg is still empty
Regards
I put it just before the switch in index view and nothing. The filter_sg is still empty
Regards
Hi Christophe,
Well, the code had something wrong, I fixed it now, please try it again!
Best regards,
Max
Well, the code had something wrong, I fixed it now, please try it again!
Best regards,
Max
Hi Max,
Sorry I saw the fixed code but on the front, I filtered by sg and go into a fiche, the filter is still right. Then i go back by clicking on "Tableau" and no filter apply!
I have this error
Parse error: syntax error, unexpected ')' in /home/.../libraries/cegcore2/admin/extensions/chronofc/functions/php/php_output.php(6) : eval()'d code on line 2
Thanks
Regards
Sorry I saw the fixed code but on the front, I filtered by sg and go into a fiche, the filter is still right. Then i go back by clicking on "Tableau" and no filter apply!
I have this error
Parse error: syntax error, unexpected ')' in /home/.../libraries/cegcore2/admin/extensions/chronofc/functions/php/php_output.php(6) : eval()'d code on line 2
Thanks
Regards
This topic is locked and no more replies can be posted.