JQUID expport en CSV jqGrid PHP Demo

////////////////////////// grid.php. query("SET NAMES utf8"); // Create the jqGrid instance $grid = new jqGridRender($conn); // Write the SQL Query $grid->SelectCommand = 'SELECT OrderID, OrderDate, CustomerID, ShipName, Freight FROM orders'; // Set output format to json $grid->dataType = 'json'; // Let the grid create the model $grid->setColModel(); // Set the url from where we obtain the data $grid->setUrl('grid.php'); // Set some grid options $grid->setGridOptions(array( "rowNum"=>10, "rowList"=>array(10,20,30), "sortname"=>"OrderID", "caption"=>"Excel export" )); // Change some property of the field(s) $grid->setColProperty("OrderDate", array( "formatter"=>"date", "formatoptions"=>array("srcformat"=>"Y-m-d H:i:s","newformat"=>"m/d/Y"), "search"=>false ) ); $grid->setColProperty("ShipName", array("label"=>"Shipper Name","width"=>"200")); $grid->setSelect('CustomerID', "SELECT CustomerID, CompanyName FROM customers"); // Enable navigator $grid->navigator = true; // Enable excel export $grid->setNavOptions('navigator', array("excel"=>true,"add"=>false,"edit"=>false,"del"=>false,"view"=>false)); // Set different filename $grid->exportfile = 'Report.xls'; // Enjoy $grid->renderGrid('#grid','#pager',true, null, null, true,true); $conn = null; ?>