Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- include_once("../../config.php");
- include(PHPGRID_LIBPATH."inc/jqgrid_dist.php");
- // set up DB
- mysql_connect(PHPGRID_DBHOST, PHPGRID_DBUSER, PHPGRID_DBPASS);
- mysql_select_db(PHPGRID_DBNAME);
- $g = new jqgrid();
- $g->table = "quf_reg";
- $g->select_command = "SELECT * FROM quf_reg";
- $opt["caption"] = "2016 Food Fair";
- $opt["autowidth"] = true;
- $opt["export"] = array("format"=>"xls",
- "filename"=>"2016foodfair",
- "heading"=>"Export to Excel Test",
- "range"=>"filtered");
- $g->set_options($opt);
- $col = array();
- $col["name"] = "name"; // field name, must be exactly same as with SQL prefix or db field
- $col["title"] = "Name";
- $col["export"] = true;
- $cols[] = $col;
- $col = array();
- $col["name"] = "contact"; // field name, must be exactly same as with SQL prefix or db field
- $col["title"] = "Contact";
- $col["export"] = true;
- $cols[] = $col;
- $col = array();
- $col["name"] = "email"; // field name, must be exactly same as with SQL prefix or db field
- $col["title"] = "Email";
- $col["export"] = true;
- $cols[] = $col;
- $col = array();
- $col["name"] = "gender"; // field name, must be exactly same as with SQL prefix or db field
- $col["title"] = "Gender";
- $col["export"] = true;
- $cols[] = $col;
- $col = array();
- $col["name"] = "age"; // field name, must be exactly same as with SQL prefix or db field
- $col["title"] = "Age";
- $col["export"] = true;
- $cols[] = $col;
- $col = array();
- $col["name"] = "address"; // field name, must be exactly same as with SQL prefix or db field
- $col["title"] = "Address";
- $col["export"] = true;
- $cols[] = $col;
- $g->set_columns($cols);
- $g->set_actions(array(
- "add"=>false,
- "edit"=>false,
- "clone"=>false,
- "bulkedit"=>false,
- "delete"=>true,
- "view"=>false,
- "rowactions"=>true,
- "export"=>true,
- "autofilter" => true,
- "search" => "simple",
- "inlineadd" => false,
- "showhidecolumns" => false
- )
- );
- $out = $g->render("list1");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement