Filter / Search is not working for on_data_display

QuestionsFilter / Search is not working for on_data_display
Aamir asked 7 years ago

I am generating a column as

$col = array();
$col["title"] = "Suppliers / Feedback";
$col["name"] = "problem_type_val";
$col["width"] = "150";
$col['on_data_display'] = array("display_type","");
$cols[] = $col;
function display_type($data)
{
$problem_type = $data["problem_type"];
$problem_type_val = $data["problem_type_val"];
//return print_r($data,true);
if($problem_type == 1) {
$qry = "SELECT supplier_name FROM suppliers WHERE suppliers_id = $problem_type_val";
$qry_run = mysql_query($qry);
$supplier_name = mysql_result($qry_run, 0);
return $supplier_name;
}
else if($problem_type == 6){
if($problem_type_val == 1)
$feedback = "Positive";
else
$feedback = "Negative";
return $feedback;
}
}

There are two types of Data. If problem type is equal to 1 then data will come from suppliers table and if problem type is equal to 6 then data is hard coded either Positive or Negative. Can you please guide why Search / Filter at the column top is not working ?

1 Answers
Abu Ghufran answered 7 years ago

As mentioned in other ticket, For search operation, in background it uses WHERE condition of sql query. So we must have equivalent database sql for your condition.

As your current display logic is not simply mapped on sql query, you might need to write database function of same logic and use it in $col["dbname"] property like mentioned in following ticket.

Reference: https://phpgrid.desk.com/customer/portal/questions/17062465-filter-search-is-not-working-for-conditional-data

Your Answer

19 + 12 =

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?