Hello,
I’ve made something like this on my grid.
$g->select_command(“SELECT FROM column1 INNER JOIN column2”);
Then I add one custom column.
$e[“on_data_display”] = array(“filter_display”, null, false);
$g->set_events($e);
function filter_display($data)
{
global $g;
$i=1;
foreach($data[“params”] as &$d)
{
$id= $d[“id”];
$g->get_one(“SELECT FROM column3 WHERE id=’$id'”);
}
}
And the question I’ve been hanging on is, how can I make use the search function for this custom column as the search function only functioning when the data is in the $g->select_command only. I’ve tried to search it and I got error.
Please help.
Search only work with WHERE clause of select_command query.
If you can include this column in select_command (using join OR subquery) then search is possible, otherwise it would not work.
So you mean it is not even possible to search the custom column that\’s not link to the select_command, right?
Yes, that’s correct. To use database driven search, the filter must be a part of WHERE clause. If you load grid with array (demos/loading/load-arrray) then it will do JS based filtering without server call.