Export Pdf – single record

QuestionsExport Pdf – single record
Daniele asked 12 years ago

Hello,
thanks for the wonderful and professional support, always fast and efficient.
Currently I have only found a way to export the entire contents of the grid. E 'can export to pdf is only one record in the grid?
thanks

6 Answers
Abu Ghufran answered 12 years ago

It is not supported as a feature. Alternate is to have a custom button or link (custom-button.php) that redirect flow to a new php page with passing PK of row, and do single row export operation there using some PDF lib.

A simplest PDF export lib could be dompdf http://code.google.com/p/dompdf/
You just create html output and pass to this lib, which generates PDF of that html.

Regards,

Daniele answered 12 years ago

I had already thought of this solution but my obstacle is how to move the contents of each record that I want to print

Abu Ghufran answered 12 years ago

With each link you can have URL querystring as row's pk.
See external-link.php for more help.

For ref.

$col["link"] = "http://localhost/?id={id}"; // e.g. http://domain.com?id={id} given that, there is a column with $col["name"] = "id" exist
$col["linkoptions"] = "target='_blank'"; // extra params with <a> tag

Daniele answered 12 years ago

The sample where is?

Abu Ghufran answered 12 years ago

Here is sample column definition.

$col = array();
$col["title"] = "Export";
$col["name"] = "export_single";
$col["width"] = "30";
$col["align"] = "center";
$col["search"] = false;
$col["sortable"] = false;
# no new line in this html, only space. otherwise it may break ui of grid
$buttons_html = "<a target='_blank' href='http://www.domain.com/export-record.php?id={id}'>Export</a>";
$col["default"] = $buttons_html;

Where export-record.php will be the file handling pdf export work and _GET["id"] will be the row id. (assuming "id" is valid column name in grid column definition)

Daniele answered 12 years ago

Great!!!

Regards, Daniele

Your Answer

7 + 0 =

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?