Advertisement
Guest User

Untitled

a guest
Nov 13th, 2016
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. include_once("../../config.php");
  2. include(PHPGRID_LIBPATH."inc/jqgrid_dist.php");
  3.  
  4. // set up DB
  5. mysql_connect(PHPGRID_DBHOST, PHPGRID_DBUSER, PHPGRID_DBPASS);
  6. mysql_select_db(PHPGRID_DBNAME);
  7.  
  8. $g = new jqgrid();
  9.  
  10. $g->table = "quf_reg";
  11. $g->select_command = "SELECT * FROM quf_reg";
  12.  
  13. $opt["caption"] = "2016 Food Fair";
  14. $opt["autowidth"] = true;
  15. $opt["export"] = array("format"=>"xls",
  16. "filename"=>"2016foodfair",
  17. "heading"=>"Export to Excel Test",
  18. "range"=>"filtered");
  19.  
  20. $g->set_options($opt);
  21.  
  22. $col = array();
  23. $col["name"] = "name"; // field name, must be exactly same as with SQL prefix or db field
  24. $col["title"] = "Name";
  25. $col["export"] = true;
  26. $cols[] = $col;
  27.  
  28. $col = array();
  29. $col["name"] = "contact"; // field name, must be exactly same as with SQL prefix or db field
  30. $col["title"] = "Contact";
  31. $col["export"] = true;
  32. $cols[] = $col;
  33.  
  34. $col = array();
  35. $col["name"] = "email"; // field name, must be exactly same as with SQL prefix or db field
  36. $col["title"] = "Email";
  37. $col["export"] = true;
  38. $cols[] = $col;
  39.  
  40. $col = array();
  41. $col["name"] = "gender"; // field name, must be exactly same as with SQL prefix or db field
  42. $col["title"] = "Gender";
  43. $col["export"] = true;
  44. $cols[] = $col;
  45.  
  46. $col = array();
  47. $col["name"] = "age"; // field name, must be exactly same as with SQL prefix or db field
  48. $col["title"] = "Age";
  49. $col["export"] = true;
  50. $cols[] = $col;
  51.  
  52. $col = array();
  53. $col["name"] = "address"; // field name, must be exactly same as with SQL prefix or db field
  54. $col["title"] = "Address";
  55. $col["export"] = true;
  56. $cols[] = $col;
  57.  
  58. $g->set_columns($cols);
  59.  
  60.  
  61. $g->set_actions(array(
  62. "add"=>false,
  63. "edit"=>false,
  64. "clone"=>false,
  65. "bulkedit"=>false,
  66. "delete"=>true,
  67. "view"=>false,
  68. "rowactions"=>true,
  69. "export"=>true,
  70. "autofilter" => true,
  71. "search" => "simple",
  72. "inlineadd" => false,
  73. "showhidecolumns" => false
  74. )
  75. );
  76.  
  77. $out = $g->render("list1");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement