To define grid structure on server-side you can use one of two modes:
In both modes you should use set_config() method where as input parameter GridConfiguration object must be specified.
In automatic mode, grid will use names of table's fields as labels for the columns.
$config = new new GridConfiguration(); $grid->set_config($config); $grid->render_table("grid50000","item_id","item_nm,item_cd");
In manual mode, structure is defined by php command. Names of commands mimic names of js commands with similar functionality.
$config = new GridConfiguration(); $config->setHeader(array("column 1","column 2")); $config->setColTypes(array("ro","ed")); $grid->set_config($config); $grid->render_table("grid50000","item_id","item_nm,item_cd");
For more information of the topics covered here, see 'defining grid structure on server-side' guide.
To export data to Excel file you should:
require("../../../codebase/convert.php");
$convert = new ConvertService("http://dhtmlx.com/docs/products/devExchange/samples/grid2excel_02/server/generate.php");
$convert->excel("some.xls",false);
Both method's parameters are optional. The first parameter is a name of output file. The second parameter specifies how file will be exported: true - as inline content, false - as individual file.
After you call the method excel(), service automatically will start to export data defined through GridConnector.
For more information of this topic, see 'Data export' guide.
To export data to pdf file you should:
require("../../../codebase/convert.php");
$convert = new ConvertService("http://dhtmlx.com/docs/products/devExchange/samples/grid2pdf_02/server/generate.php");
$convert->pdf("some.pdf",false);
Both method's parameters are optional. The first parameter is a name of output file. The second parameter specifies how file will be exported: true - as inline content, false - as individual file.
After you call the method pdf(), service automatically will start to export data defined through GridConnector.
For more information of this topic, see 'Data export' guide.
Using KeyGridConnector instead of GridConnector, you can load data from a table without identity field. In this case, any data field will serve as identity.
$grid = new KeyGridConnector($res); $grid->render_table("mytable","name","name,address,phone");
For more details, see 'KeyGridConnector' guide.
Using set_row_color() method you can set a certain color for a row.
$dataItem->set_row_color($color)
Using methods set_cell_style() and set_row_style you can set some style for a row or cell.
$dataItem->set_row_style($style); // $dataItem->set_cell_style($style);
where $style specifies HTML style attributes.