www/js/rec_main.js

changeset 471
0bf73d605604
parent 286
124af734af68
child 473
5c7566f6d42a
equal deleted inserted replaced
470:94a69f6b0f35 471:0bf73d605604
1 /***************************************************************************** 1 /*****************************************************************************
2 * Copyright (C) 2018 2 * Copyright (C) 2018-2019
3 * 3 *
4 * Michiel Broek <mbroek at mbse dot eu> 4 * Michiel Broek <mbroek at mbse dot eu>
5 * 5 *
6 * This file is part of BMS 6 * This file is part of BMS
7 * 7 *
36 { name: 'est_ibu', type: 'float' }, 36 { name: 'est_ibu', type: 'float' },
37 { name: 'est_abv', type: 'float' }, 37 { name: 'est_abv', type: 'float' },
38 ], 38 ],
39 id: 'record', 39 id: 'record',
40 url: "includes/db_recipes.php" 40 url: "includes/db_recipes.php"
41 }; 41 },
42 var dataAdapter = new $.jqx.dataAdapter(source); 42 dataAdapter = new $.jqx.dataAdapter(source);
43
43 // initialize jqxGrid 44 // initialize jqxGrid
44 $("#jqxgrid").jqxGrid({ 45 $("#jqxgrid").jqxGrid({
45 width: 1280, 46 width: 1280,
46 height: 630, 47 height: 630,
47 source: dataAdapter, 48 source: dataAdapter,
48 groupable: true, 49 groupable: true,
49 theme: theme, 50 theme: theme,
50 showstatusbar: true, 51 showstatusbar: true,
51 renderstatusbar: function (statusbar) { 52 renderstatusbar: function (statusbar) {
52 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); 53 var addButton, container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
53 var addButton = $("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Add</span></div>"); 54 addButton = $("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Add</span></div>");
54 container.append(addButton); 55 container.append(addButton);
55 statusbar.append(container); 56 statusbar.append(container);
56 addButton.jqxButton({ theme: theme, width: 100, height: 20 }); 57 addButton.jqxButton({ theme: theme, width: 100, height: 20 });
57 // add new recipe. 58 // add new recipe.
58 addButton.click(function (event) { 59 addButton.click(function (event) {
59 var url= "rec_new.php?return=rec_main.php"; 60 window.location.href = "rec_new.php?return=rec_main.php";
60 window.location.href = url;
61 }); 61 });
62 }, 62 },
63 filterable: true, 63 filterable: true,
64 filtermode: 'excel', 64 filtermode: 'excel',
65 columns: [ 65 columns: [
73 { text: 'ABV', datafield: 'est_abv', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, 73 { text: 'ABV', datafield: 'est_abv', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'p1' },
74 { text: '', datafield: 'Edit', width: 120, align: 'center', columntype: 'button', cellsrenderer: function () { 74 { text: '', datafield: 'Edit', width: 120, align: 'center', columntype: 'button', cellsrenderer: function () {
75 return "Wijzig"; 75 return "Wijzig";
76 }, buttonclick: function (row) { 76 }, buttonclick: function (row) {
77 var datarecord = dataAdapter.records[row]; 77 var datarecord = dataAdapter.records[row];
78 var url= "rec_edit.php?record=" + datarecord.record + "&return=rec_main.php"; 78 window.location.href = "rec_edit.php?record=" + datarecord.record + "&return=rec_main.php";
79 window.location.href = url;
80 } 79 }
81 } 80 }
82 ], 81 ],
83 groups: ['st_guide','st_letter' ] 82 groups: ['st_guide','st_letter' ]
84 }); 83 });

mercurial