Searching Custom Column

QuestionsSearching Custom Column
Hafiz asked 11 months ago


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);
function filter_display($data)

global $g;
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.

4 Answers
Abu Ghufran Staff answered 11 months ago

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.

Abu Ghufran - Dev Team
Grid 4 PHP Framework
Hafiz answered 11 months ago

So you mean it is not even possible to search the custom column that\’s not link to the select_command, right?

Abu Ghufran Staff answered 10 months ago

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.

Abu Ghufran - Dev Team
Grid 4 PHP Framework
Hafiz answered 10 months ago

Ok. Thank you for the response

Your Answer

0 + 14 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.

How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?