77 type: 'POST', |
77 type: 'POST', |
78 success: function(data, status, xhr) { |
78 success: function(data, status, xhr) { |
79 commit(true); |
79 commit(true); |
80 location.reload(true); |
80 location.reload(true); |
81 }, |
81 }, |
82 error: function(jqXHR, textStatus, errorThrown) { |
82 error: function(jqXHR, textStatus, errorThrown) { commit(false); } |
83 commit(false); |
|
84 } |
|
85 }); |
83 }); |
86 }, |
84 }, |
87 addrow: function(rowid, rowdata, position, commit) { |
85 addrow: function(rowid, rowdata, position, commit) { |
88 var data = 'insert=true&' + $.param(rowdata); |
86 var data = 'insert=true&' + $.param(rowdata); |
89 $.ajax({ |
87 $.ajax({ |
94 type: 'POST', |
92 type: 'POST', |
95 success: function(data, status, xhr) { |
93 success: function(data, status, xhr) { |
96 commit(true); |
94 commit(true); |
97 location.reload(true); |
95 location.reload(true); |
98 }, |
96 }, |
99 error: function(jqXHR, textStatus, errorThrown) { |
97 error: function(jqXHR, textStatus, errorThrown) { commit(false); } |
100 commit(false); |
|
101 } |
|
102 }); |
98 }); |
103 }, |
99 }, |
104 updaterow: function(rowid, rowdata, commit) { |
100 updaterow: function(rowid, rowdata, commit) { |
105 var data = 'update=true&' + $.param(rowdata); |
101 var data = 'update=true&' + $.param(rowdata); |
106 $.ajax({ |
102 $.ajax({ |
226 $('#inittemp_lo').jqxNumberInput({ max: 45 }); |
220 $('#inittemp_lo').jqxNumberInput({ max: 45 }); |
227 $('#inittemp_hi').jqxNumberInput(Spin1dec); |
221 $('#inittemp_hi').jqxNumberInput(Spin1dec); |
228 $('#inittemp_hi').jqxNumberInput({ max: 45 }); |
222 $('#inittemp_hi').jqxNumberInput({ max: 45 }); |
229 $('#fridgemode').jqxCheckBox({ theme: theme, height: 23, enableContainerClick: false }); |
223 $('#fridgemode').jqxCheckBox({ theme: theme, height: 23, enableContainerClick: false }); |
230 |
224 |
|
225 var localizationobj = {}; |
|
226 localizationobj.filterchoosestring= "Keuze:"; |
|
227 |
231 // initialize jqxGrid |
228 // initialize jqxGrid |
232 $('#jqxgrid').jqxGrid({ |
229 $('#jqxgrid').jqxGrid({ |
233 width: 1280, |
230 width: 1280, |
234 height: 630, |
231 height: 630, |
235 source: dataAdapter, |
232 source: dataAdapter, |
236 theme: theme, |
233 theme: theme, |
237 showstatusbar: true, |
234 showstatusbar: true, |
238 renderstatusbar: function(statusbar) { |
235 renderstatusbar: function(statusbar) { |
239 var container = $('<div style="overflow: hidden; position: relative; margin: 5px;"></div>'); |
236 var container = $('<div style="overflow: hidden; position: relative; margin: 5px;"></div>'); |
240 var addButton = $('<div style="float: right; margin-right: 15px;"><img style="position: relative; margin-top: 2px;" ' + |
237 var addButton = $('<div style="float: right; margin-right: 15px;"><img style="position: relative; margin-top: 2px;" ' + |
241 'src="images/add.png"/><span style="margin-left: 4px; position: relative; top: -3px;">Nieuw</span></div>'); |
238 'src="images/add.png"/><span style="margin-left: 4px; position: relative; top: -4px;">Nieuw</span></div>'); |
242 container.append(addButton); |
239 container.append(addButton); |
243 statusbar.append(container); |
240 statusbar.append(container); |
244 addButton.jqxButton({ theme: theme, width: 90, height: 20 }); |
241 addButton.jqxButton({ theme: theme, width: 90, height: 17 }); |
245 // add new row. |
242 // add new row. |
246 addButton.click(function(event) { |
243 addButton.click(function(event) { |
247 editrow = -1; |
244 editrow = -1; |
248 $('#name').val('Nieuw vergist profiel'); |
245 $('#name').val('Nieuw vergist profiel'); |
249 dataRecord.uuid = ''; |
246 dataRecord.uuid = ''; |
254 dataRecord.duration = 0; |
251 dataRecord.duration = 0; |
255 editsteps(''); |
252 editsteps(''); |
256 $('#popupWindow').jqxWindow('open'); |
253 $('#popupWindow').jqxWindow('open'); |
257 }); |
254 }); |
258 }, |
255 }, |
259 filterable: false, |
256 ready: function () { |
|
257 $("#jqxgrid").jqxGrid('localizestrings', localizationobj); |
|
258 }, |
|
259 filterable: true, |
|
260 showfilterrow: true, |
260 columns: [ |
261 columns: [ |
261 { text: 'Vergisting profiel', datafield: 'name' }, |
262 { text: 'Vergisting profiel', datafield: 'name', filtertype: 'textbox' }, |
262 { text: 'Min. start °C', datafield: 'inittemp_lo', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, |
263 { text: 'Min. start °C', datafield: 'inittemp_lo', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f1', filtertype: 'number' }, |
263 { text: 'Max. start °C', datafield: 'inittemp_hi', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, |
264 { text: 'Max. start °C', datafield: 'inittemp_hi', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f1', filtertype: 'number' }, |
264 { text: 'Sensor', datafield: 'fridgemode', align: 'right', width: 80, |
265 { text: 'Sensor', datafield: 'fridgemode', align: 'right', width: 80, filterable: false, |
265 cellsrenderer: function(row, columnfield, value, defaulthtml, column) { |
266 cellsrenderer: function(row, columnfield, value, defaulthtml, column) { |
266 if (value == 0) |
267 if (value == 0) |
267 return '<span style="margin: 3px; margin-top: 6px; float: right;">Bier</span>'; |
268 return '<span style="margin: 3px; margin-top: 6px; float: right;">Bier</span>'; |
268 else |
269 else |
269 return '<span style="margin: 3px; margin-top: 6px; float: right;">Koelkast</span>'; |
270 return '<span style="margin: 3px; margin-top: 6px; float: right;">Koelkast</span>'; |
270 } |
271 } |
271 }, |
272 }, |
272 { text: 'Stappen', datafield: 'totalsteps', width: 80, align: 'right', cellsalign: 'right' }, |
273 { text: 'Stappen', datafield: 'totalsteps', width: 80, align: 'right', cellsalign: 'right', filterable: false }, |
273 { text: 'Tijdsduur', datafield: 'duration', width: 150, align: 'right', |
274 { text: 'Tijdsduur', datafield: 'duration', width: 150, align: 'right', filterable: false, |
274 cellsrenderer: function(row, columnfield, value, defaulthtml, column) { |
275 cellsrenderer: function(row, columnfield, value, defaulthtml, column) { |
275 var show, days, hours; |
276 var show, days, hours; |
276 if (value < 24) { |
277 if (value < 24) { |
277 show = value + ' uur'; |
278 show = value + ' uur'; |
278 } else { |
279 } else { |
284 show = days + ' dagen, ' + hours + ' uur'; |
285 show = days + ' dagen, ' + hours + ' uur'; |
285 } |
286 } |
286 return '<span style="margin: 3px; margin-top: 6px; float: right;">' + show + '</span>'; |
287 return '<span style="margin: 3px; margin-top: 6px; float: right;">' + show + '</span>'; |
287 } |
288 } |
288 }, |
289 }, |
289 { text: '', datafield: 'Edit', width: 100, align: 'center', columntype: 'button', cellsrenderer: |
290 { text: '', datafield: 'Edit', width: 100, align: 'center', columntype: 'button', filterable: false, cellsrenderer: |
290 function() { |
291 function() { |
291 return 'Wijzig'; |
292 return 'Wijzig'; |
292 }, buttonclick: function(row) { |
293 }, buttonclick: function(row) { |
293 editrow = row; |
294 editrow = row; |
294 // get the clicked row's data and initialize the input fields. |
295 // get the clicked row's data and initialize the input fields. |