on_render_csv exist?

Questionson_render_csv exist?
Adrian Sirbu asked 5 years ago

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

1 Answers
Abu Ghufran Staff answered 5 years ago

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

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Your Answer

9 + 1 =

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?