Hi,
I want to use $e[“on_render_csv”] … something likeĀ $e[“on_render_excel”] = array(“custom_export”, null, true); but for exporting to CSV file and change some select value.
It’s possible?
function custom_export($param)
{
global $g;
// lookup of dropdown
$sql1 = “select id as k, tipoperatiune as v from cnpp_nomenclator_tip_operatiuni”;
$result1 = $g->execute_query($sql1);
if ($g->con)
{
$arr1 = $result1->GetRows();
foreach($arr1 as $rs1)
{
$rs1[“k”] = (!empty($rs1[“K”])) ? $rs1[“K”] : $rs1[“k”];
$rs1[“v”] = (!empty($rs1[“V”])) ? $rs1[“V”] : $rs1[“v”];
$lookup1[$rs1[“k”]] = $rs1[“v”];
}
}
$data = &$param[“data”]; // the complete grid object reference
$i=0;
foreach($data as &$d)
{
// skip first column title
if ($i++ == 0) continue;
$d[“idtipop”] = $lookup1[$d[“idtipop”]];
}
}
In excel working.
Thanks
Hello,
You can use custom export for csv as well. See demo code.
http://phpgrid.org/demo/demos/export/export-custom.phps
Refer Line 51,55,129