Hi, How can i change the content of the filter?
I already changed the look with this function in the connector:
function formatting($row)
{
$data = $row->get_value(“GebDat”);
//GebDat format = Ymd
$row->set_value(“GebDat”,date(“d-m-Y”,strtotime($data)));
}
$grid->event->attach(“beforeRender”,“formatting”);
but how can i make that the #connector_text_filter searches in the same format? (input format the same as in my connector)
Olga
#2
i know, i made a reply on the bottom of that page:
docs.dhtmlx.com/doku.php?id=dhtm … :filtering
could you please answer that/this question:
I want to change the format of a date…
already did the look with this function:
function formatting($row)
{
$data = $row->get_value(“GebDat”);
$row->set_value(“GebDat”,date(“d-m-Y”,strtotime($data)));
}$grid→event→attach(“beforeRender”,”formatting”);
but the filter still works with the old format, how can i make the above function working with:
$grid→event→attach(“beforeFilter”,”custom_filter”);
The original date format is Ymd, i want the filter to search the date colom like: dmy
Filter works on SQL level, so you need to convert incoming date format for SQL compatible one
“Redefine default filtering logic” snippet at
docs.dhtmlx.com/doku.php?id=dhtm … :filtering
and
docs.dhtmlx.com/doku.php?id=dhtm … ace_object
You can use similar logic and set
$filter_by->rules[$index][“value”] = some_conversion ($filter_by->rules[$index][“value”]);
i cant get it to work, could you please write the function for the date format?
thnx in advance!
Something similar to the next
function some_conversion($data){
//Ymd
$year = substr($data, 0, 4);
$month = substr($data, 4,2);
$day = substr($data, 0, 2);
return $year."-".$month."-".$day;
}
with this code i get the alert:
Warning: Attempt to modify property of non-object in FILE on line 53
function some_conversion($data){
$year = substr($data, 0, 4);
$month = substr($data, 4,2);
$day = substr($data, 0, 2);
return $year."-".$month."-".$day;
}
function custom_filter($filter_by)
{
$filter_by->rules[$index][“GebDat”] = some_conversion($filter_by->rules[$index][“GebDat”]);
}
$grid->event->attach(“beforeFilter”,“custom_filter”);
docs.dhtmlx.com/doku.php?id=dhtm … :filtering
function custom_filter($filter_by)
{
$index = $filter_by->index("some_field");
if ($index!==false)
$filter_by->rules[$index]["GebDat"] = some_conversion($filter_by->rules[$index]["GebDat"]);
}
thnx for your help, but i still get an alert:
Fatal error: Call to a member function index() on a non-object in:…
what may cause this?
Hi,
sry but i don’t understand the dhtmlxconnector:filtering documentation.
I tried this and some other, to replace a " " to % and later i want to transform “*” to “%”, too:
function custom_filter($filter_by){
$index = $filter_by->index("tag_title");
// $index = $filter_by->index("some_field");
if ($index!==false)
$filter_by->rules[$index]["tag_title"] = str_replace(" ","%",$filter_by->rules[$index]["tag_title"]);
}
$grid->event->attach("beforeFilter","custom_filter");