Hello Abu,
I have this function to get values in different tables:
function bonus_data($data)
{
$t = $data["params"]["reference_no"];
$client_id = $data["params"]["customer_id"];
global $h;
$res = $h->execute_query("select id, name, company, award_points from sma_companies WHERE id = '$client_id'");
#phpgrid_error($h->con->errormsg());
$arr = $res->GetRows();
#phpgrid_error($arr);
$document = $arr[0]["name"];
$client_name= $arr[0]["company"];
$points= $arr[0]["award_points"];
}
As this values are from table different to sales_table (grid table)
then i need it values in same grid as Virtual Columns getting Cols:
var rowid = jQuery("#list1").jqGrid("getGridParam","selrow");
var row = $("#list1").getRowData(rowid);
It's possible?
Thank you again!
If your client_id is dropdown column, you can have callback function that will fill other fields of form by running query.
For detail, refer demos/appearance/dropdown-callback.php
Beside this, there is no such option in grid library.
Hello Abu,
I have been studying grid events tried this:
// virtual column to show award_points
$col = array();
$col["title"] = "Puntos";
$col["name"] = "vpuntos";
$col["width"] = "400";
$col["hidden"] = false;
$sales[] = $col;
function filter_points($data)
{
$t = $data["params"]["reference_no"];
$client_id = $data["params"]["customer_id"];
global $h;
$res = $h->execute_query("select id, name, company, award_points from sma_companies WHERE id = '$client_id'");
$arr = $res->GetRows();
$document = $arr[0]["name"];
$client_name= $arr[0]["company"];
$data["params"]["vpuntos"] = $arr[0]["award_points"];
}
Then set event so:
$e["on_data_display"] = array("filter_points", null, true);
$h->set_events($e);
I understand that event On_Data_Display is to show grid, so would have to be an option, but not show data row.
Thank you!