Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $base_path = strstr(realpath("."),"demos",true)."lib/";
- include($base_path."inc/jqgrid_dist.php");
- $grid = new jqgrid();
- $opt["caption"] = "Produkter";
- $opt["rowNum"] = 60;
- $opt["multiselect"] = false;
- $opt["autowidth"] = true;
- $opt["resizable"] = false;
- $opt["height"] = "600";
- $opt["export"]["range"] = "filtered";
- $opt["actionicon"] = false;
- $opt["scroll"] = true;
- // following params will enable subgrid -- by default 'rowid' (PK) of parent is passed
- $opt["subGrid"] = true;
- $opt["subgridurl"] = "subgrid_detail.php";
- $grid->set_options($opt);
- $grid->set_actions(array(
- "add"=>true, // allow/disallow add
- "edit"=>true, // allow/disallow edit
- "delete"=>true, // allow/disallow delete
- "rowactions"=>true, // show/hide row wise edit/del/save option
- "export"=>true, // show/hide export to excel option
- "autofilter" => true, // show/hide autofilter for search
- "search" => "advance" // show single/multi field search condition (e.g. simple or advance)
- )
- );
- $grid->select_command = "SELECT *, (select count(*) as c FROM omsUrl where omsWeb.productCode = omsUrl.articleNumber) as c from omsWeb WHERE 1=1";
- $grid->table = "omsWeb";
- $col = array();
- $col["title"] = "Artikelkod";
- $col["name"] = "productCode";
- $col["editable"] = true;
- $col["width"] = "50";
- $cols[] = $col;
- $col = array();
- $col["title"] = "Märke";
- $col["name"] = "brand";
- $col["width"] = "60";
- $col["editable"] = true;
- $cols[] = $col;
- $col = array();
- $col["title"] = "Benämning";
- $col["name"] = "productName";
- $cols[] = $col;
- $col = array();
- $col["title"] = "Lägsta pris";
- $col["name"] = "billigastePris";
- $col["width"] = "30";
- $col["align"] = "right";
- $cols[] = $col;
- $col = array();
- $col["title"] = "Antal priser";
- $col["name"] = "c";
- $col["width"] = "30";
- $col["align"] = "center";
- $cols[] = $col;
- $grid->set_columns($cols);
- $out = $grid->render("list1");
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
- <html>
- <head>
- <link rel="stylesheet" type="text/css" media="screen" href="../../lib/js/themes/redmond/jquery-ui.custom.css"></link>
- <link rel="stylesheet" type="text/css" media="screen" href="../../lib/js/jqgrid/css/ui.jqgrid.css"></link>
- <script src="../../lib/js/jquery.min.js" type="text/javascript"></script>
- <script src="../../lib/js/jqgrid/js/i18n/grid.locale-en.js" type="text/javascript"></script>
- <script src="../../lib/js/jqgrid/js/jquery.jqGrid.min.js" type="text/javascript"></script>
- <script src="../../lib/js/themes/jquery-ui.custom.min.js" type="text/javascript"></script>
- </head>
- <body>
- <div style="margin:10px">
- <?php echo $out?>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement