I get a garbled mess for export and xls.
pdf I get the following error: TCPDF ERROR: Some data has already been output to browser, can’t send PDF file
csv doesn’t offer a download/save dialog
and HTML just displays a table.
Hello,
I can suggest better by reviewing the grid code.
There are usually 2 reasons for this.
1) Blank space character at the very start of current file OR some included file (new line or space or enter)
2) Invisible BOM character at start of file
In case #1, It will give header already sent error.
In case #2, It will push all pdf data binary as html text.
White spaces can be removed by checking top and end of all included files.
To remove invisible BOM character, i would recommend Notepad++ -> Open file -> Encoding menu -> Encode UTF without BOM
Here is code:
PHPGRID_DBTYPE,
"server" => PHPGRID_DBHOST,
"user" => PHPGRID_DBUSER,
"password" => PHPGRID_DBPASS,
"database" => PHPGRID_DBNAME
);
$g = new jqgrid($db_conf);
// set few params
$opt["caption"] = "Employee Paychex";
$opt["sortname"] = 'employee_sak';
$opt["sortorder"] = "asc";
$g->set_options($opt);
$g->set_actions(array(
"clone"=>false,
"bulkedit"=>false,
"rowactions"=>true,
"export"=>true,
"export_pdf"=>true,
"export_excel"=>true,
"export_csv"=>true,
"export_html"=>true,
"import"=>false,
"autofilter" => true,
"search" => "simple",
"inlineadd" => false,
"showhidecolumns" => true
));
// set database table for CRUD operations
$g->table = "employee_paychex";
// pass the cooked columns to grid
$g->set_columns($cols);
// render grid and get html/js output
$out = $g->render("list");
/* ******** Grid4PHP ******** */
?>
This code segment is fine. Issues could be when integrating this code with other files.
Please share complete file OR you can email me at [email protected] if there are many.
Yes, your code seems fine. We might need remote session to debug this case. I’ve sent you messages on email and googel chat as well.