Searching Custom Column

QuestionsSearching Custom Column
Hafiz asked 5 years ago

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.

4 Answers
Abu Ghufran Staff answered 5 years 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 5 years 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 5 years 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 5 years ago

Ok. Thank you for the response

Your Answer

0 + 13 =

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?