Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by nicolas on Jan 20, 2010 05:21
open dhtmlx forum
connector beforeFilter

Hello,

I try to use "beforeFilter" event to customize my filter.

I use:
"
$gridConn->set_options("study.StudyDate",array("Ce jour"=>1,"Cette semaine"=>2,"Ce mois"=>3));
"

and my function:
"
    function doBeforeFilter($filter_by){
        //vairables définie en entète de fichier php
        
        $ind = $filter_by->index("study.StudyDate");
        if ($ind!==false){
            if($filter_by->rules[$ind]["value"] == "Ce jour") {
                $date = date("Ymd");
                $filter_by->rules[$ind]["value"] = $date;
                $filter_by->rules[$ind]["operation"] = ">";
                print_r($date);
            }
}
}
"
My problem is the final query is
SELECT ....... WHERE study.StudyDate LIKE '%Ce jour%'.

I put some log in your base_connector.php file:

function: render()

"
LogMaster::log("---------filter before: ",$this->request->get_filters());
$this->event->trigger("beforeFilter",new FilterInterface($this->request));
LogMaster::log("---------filter before: ",$this->request->get_filters());
"

I get my message "print_r($date);" with the right date but in your log file "some.txt"
the filter before and after is the same.
"
.....
4 =>
    name => study.StudyDate
    value => Ce jour
    operation =>
5 =>
....
"

Any suggestion,
regards

Answer posted by Stanislav (support) on Jan 23, 2010 01:56
Answer was sent by email