19 * along with ThermFerm; see the file COPYING. If not, write to the Free |
19 * along with ThermFerm; see the file COPYING. If not, write to the Free |
20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
21 *****************************************************************************/ |
21 *****************************************************************************/ |
22 |
22 |
23 |
23 |
24 $(document).ready(function () { |
24 $(document).ready(function() { |
25 var source = { |
25 var source = { |
26 datatype: "json", |
26 datatype: 'json', |
27 cache: false, |
27 cache: false, |
28 datafields: [ |
28 datafields: [ |
29 { name: 'record', type: 'number' }, |
29 { name: 'record', type: 'number' }, |
30 { name: 'st_name', type: 'string' }, |
30 { name: 'st_name', type: 'string' }, |
31 { name: 'st_letter', type: 'string' }, |
31 { name: 'st_letter', type: 'string' }, |
32 { name: 'st_guide', type: 'string' }, |
32 { name: 'st_guide', type: 'string' }, |
33 { name: 'name', type: 'string' }, |
33 { name: 'name', type: 'string' }, |
34 { name: 'est_og', type: 'float' }, |
34 { name: 'est_og', type: 'float' }, |
35 { name: 'est_color', type: 'float' }, |
35 { name: 'est_color', type: 'float' }, |
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 dataAdapter = new $.jqx.dataAdapter(source); |
42 dataAdapter = new $.jqx.dataAdapter(source); |
43 |
43 |
44 // initialize jqxGrid |
44 // initialize jqxGrid |
45 $("#jqxgrid").jqxGrid({ |
45 $('#jqxgrid').jqxGrid({ |
46 width: 1280, |
46 width: 1280, |
47 height: 630, |
47 height: 630, |
48 source: dataAdapter, |
48 source: dataAdapter, |
49 groupable: true, |
49 groupable: true, |
50 theme: theme, |
50 theme: theme, |
51 showstatusbar: true, |
51 showstatusbar: true, |
52 renderstatusbar: function (statusbar) { |
52 renderstatusbar: function(statusbar) { |
53 var addButton, container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
53 var addButton, container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></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 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>"); |
55 container.append(addButton); |
55 container.append(addButton); |
56 statusbar.append(container); |
56 statusbar.append(container); |
57 addButton.jqxButton({ theme: theme, width: 100, height: 20 }); |
57 addButton.jqxButton({ theme: theme, width: 100, height: 20 }); |
58 // add new recipe. |
58 // add new recipe. |
59 addButton.click(function (event) { |
59 addButton.click(function(event) { |
60 window.location.href = "rec_new.php?return=rec_main.php"; |
60 window.location.href = 'rec_new.php?return=rec_main.php'; |
61 }); |
61 }); |
62 }, |
62 }, |
63 filterable: true, |
63 filterable: true, |
64 filtermode: 'excel', |
64 filtermode: 'excel', |
65 columns: [ |
65 columns: [ |
66 { text: 'Stijlgids', datafield: 'st_guide', width: 120 }, |
66 { text: 'Stijlgids', datafield: 'st_guide', width: 120 }, |
67 { text: 'Letter', datafield: 'st_letter', width: 60 }, |
67 { text: 'Letter', datafield: 'st_letter', width: 60 }, |
68 { text: 'Stijl', datafield: 'st_name', width: 160 }, |
68 { text: 'Stijl', datafield: 'st_name', width: 160 }, |
69 { text: 'Naam', datafield: 'name' }, |
69 { text: 'Naam', datafield: 'name' }, |
70 { text: 'OG', datafield: 'est_og', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f3' }, |
70 { text: 'OG', datafield: 'est_og', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f3' }, |
71 { text: 'EBC', datafield: 'est_color', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f0' }, |
71 { text: 'EBC', datafield: 'est_color', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f0' }, |
72 { text: 'IBU', datafield: 'est_ibu', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f0' }, |
72 { text: 'IBU', datafield: 'est_ibu', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f0' }, |
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 window.location.href = "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 } |
79 } |
80 } |
80 } |
81 ], |
81 ], |
82 groups: ['st_guide','st_letter' ] |
82 groups: ['st_guide', 'st_letter'] |
83 }); |
83 }); |
84 }); |
84 }); |