SHARE
TWEET

Untitled

a guest Jan 21st, 2016 45 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $base_path = strstr(realpath("."),"demos",true)."lib/";
  2. include($base_path."inc/jqgrid_dist.php");
  3.  
  4. $grid = new jqgrid();
  5.  
  6. $opt["caption"] = "Produkter";
  7.  
  8. $opt["rowNum"] = 60;
  9. $opt["multiselect"] = false;
  10. $opt["autowidth"] = true;
  11. $opt["resizable"] = false;
  12. $opt["height"] = "600";
  13. $opt["export"]["range"] = "filtered";
  14. $opt["actionicon"] = false;
  15. $opt["scroll"] = true;
  16.  
  17.  
  18. // following params will enable subgrid -- by default 'rowid' (PK) of parent is passed
  19. $opt["subGrid"] = true;
  20. $opt["subgridurl"] = "subgrid_detail.php";
  21.  
  22.  
  23. $grid->set_options($opt);
  24.  
  25.  
  26. $grid->set_actions(array(  
  27.                         "add"=>true, // allow/disallow add
  28.                         "edit"=>true, // allow/disallow edit
  29.                         "delete"=>true, // allow/disallow delete
  30.                         "rowactions"=>true, // show/hide row wise edit/del/save option
  31.                         "export"=>true, // show/hide export to excel option
  32.                         "autofilter" => true, // show/hide autofilter for search
  33.                         "search" => "advance" // show single/multi field search condition (e.g. simple or advance)
  34.                     )
  35.                 );
  36.  
  37.  
  38. $grid->select_command = "SELECT *, (select count(*) as c FROM omsUrl where omsWeb.productCode = omsUrl.articleNumber) as c from omsWeb WHERE 1=1";
  39.  
  40. $grid->table = "omsWeb";
  41.  
  42. $col = array();
  43. $col["title"] = "Artikelkod";
  44. $col["name"] = "productCode";
  45. $col["editable"] = true;
  46. $col["width"] = "50";
  47. $cols[] = $col;
  48.  
  49. $col = array();
  50. $col["title"] = "Märke";
  51. $col["name"] = "brand";
  52. $col["width"] = "60";
  53. $col["editable"] = true;
  54. $cols[] = $col;
  55.  
  56. $col = array();
  57. $col["title"] = "Benämning";
  58. $col["name"] = "productName";
  59. $cols[] = $col;
  60.  
  61. $col = array();
  62. $col["title"] = "Lägsta pris";
  63. $col["name"] = "billigastePris";
  64. $col["width"] = "30";
  65. $col["align"] = "right";
  66. $cols[] = $col;
  67.  
  68. $col = array();
  69. $col["title"] = "Antal priser";
  70. $col["name"] = "c";
  71. $col["width"] = "30";
  72. $col["align"] = "center";
  73. $cols[] = $col;
  74.  
  75. $grid->set_columns($cols);
  76.  
  77. $out = $grid->render("list1");
  78.  
  79. ?>
  80. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  81. <html>
  82. <head>
  83.     <link rel="stylesheet" type="text/css" media="screen" href="../../lib/js/themes/redmond/jquery-ui.custom.css"></link>
  84.     <link rel="stylesheet" type="text/css" media="screen" href="../../lib/js/jqgrid/css/ui.jqgrid.css"></link>  
  85.    
  86.     <script src="../../lib/js/jquery.min.js" type="text/javascript"></script>
  87.     <script src="../../lib/js/jqgrid/js/i18n/grid.locale-en.js" type="text/javascript"></script>
  88.     <script src="../../lib/js/jqgrid/js/jquery.jqGrid.min.js" type="text/javascript"></script>  
  89.     <script src="../../lib/js/themes/jquery-ui.custom.min.js" type="text/javascript"></script>
  90. </head>
  91. <body>
  92.     <div style="margin:10px">
  93.     <?php echo $out?>
  94.     </div>
  95.  
  96. </body>
  97. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top