www/js/profile_fermentation.js

changeset 523
3cccf4392a25
parent 494
af28ebe4a779
child 548
c67cd0d9249b
equal deleted inserted replaced
522:35675eadc655 523:3cccf4392a25
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 function createDelElements() { 24 function createDelElements() {
25 $('#eventWindow').jqxWindow({ 25 $('#eventWindow').jqxWindow({
26 theme: theme, 26 theme: theme,
27 position: { x: 490, y: 210 }, 27 position: { x: 490, y: 210 },
28 width: 300, 28 width: 300,
29 height: 175, 29 height: 175,
30 resizable: false, 30 resizable: false,
31 isModal: true, 31 isModal: true,
32 modalOpacity: 0.4, 32 modalOpacity: 0.4,
33 okButton: $('#delOk'), 33 okButton: $('#delOk'),
34 cancelButton: $('#delCancel'), 34 cancelButton: $('#delCancel'),
35 initContent: function () { 35 initContent: function() {
36 $('#delOk').jqxButton({ template: "danger", width: '65px', theme: theme }); 36 $('#delOk').jqxButton({ template: 'danger', width: '65px', theme: theme });
37 $('#delCancel').jqxButton({ template: "success", width: '65px', theme: theme }); 37 $('#delCancel').jqxButton({ template: 'success', width: '65px', theme: theme });
38 $('#delCancel').focus(); 38 $('#delCancel').focus();
39 } 39 }
40 }); 40 });
41 $('#eventWindow').jqxWindow('hide'); 41 $('#eventWindow').jqxWindow('hide');
42 } 42 }
43 43
44 44
45 $(document).ready(function () { 45 $(document).ready(function() {
46 46
47 // tooltips 47 // tooltips
48 $("#name").jqxTooltip({ content: 'De naam voor dit vergisting profiel.' }); 48 $('#name').jqxTooltip({ content: 'De naam voor dit vergisting profiel.' });
49 $("#inittemp_lo").jqxTooltip({ content: 'De minimale begin temperatuur van dit profiel.' }); 49 $('#inittemp_lo').jqxTooltip({ content: 'De minimale begin temperatuur van dit profiel.' });
50 $("#inittemp_hi").jqxTooltip({ content: 'De maximale begin temperatuur van dit profiel.' }); 50 $('#inittemp_hi').jqxTooltip({ content: 'De maximale begin temperatuur van dit profiel.' });
51 51
52 var dataRecord = {}, 52 var dataRecord = {},
53 url = 'includes/db_profile_fermentation.php', 53 url = 'includes/db_profile_fermentation.php',
54 // prepare the data 54 source = {
55 source = { 55 datatype: 'json',
56 datatype: "json", 56 cache: false,
57 cache: false, 57 datafields: [
58 datafields: [ 58 { name: 'record', type: 'number' },
59 { name: 'record', type: 'number' }, 59 { name: 'uuid', type: 'string' },
60 { name: 'uuid', type: 'string' }, 60 { name: 'name', type: 'string' },
61 { name: 'name', type: 'string' }, 61 { name: 'inittemp_lo', type: 'float' },
62 { name: 'inittemp_lo', type: 'float' }, 62 { name: 'inittemp_hi', type: 'float' },
63 { name: 'inittemp_hi', type: 'float' }, 63 { name: 'fridgemode', type: 'int' },
64 { name: 'fridgemode', type: 'int' }, 64 { name: 'totalsteps', type: 'int' },
65 { name: 'totalsteps', type: 'int' }, 65 { name: 'duration', type: 'int' },
66 { name: 'duration', type: 'int' }, 66 { name: 'steps', type: 'array' }
67 { name: 'steps', type: 'array' } 67 ],
68 ], 68 id: 'record',
69 id: 'record', 69 url: url,
70 url: url, 70 deleterow: function(rowid, commit) {
71 deleterow: function (rowid, commit) { 71 var data = 'delete=true&' + $.param({ record: rowid });
72 // synchronize with the server - send delete command 72 $.ajax({
73 var data = "delete=true&" + $.param({ record: rowid }); 73 dataType: 'json',
74 $.ajax({ 74 url: url,
75 dataType: 'json', 75 cache: false,
76 url: url, 76 data: data,
77 cache: false, 77 type: 'POST',
78 data: data, 78 success: function(data, status, xhr) {
79 type: "POST", 79 commit(true);
80 success: function (data, status, xhr) { 80 location.reload(true);
81 commit(true); 81 },
82 location.reload( true ); 82 error: function(jqXHR, textStatus, errorThrown) {
83 }, 83 commit(false);
84 error: function (jqXHR, textStatus, errorThrown) { 84 }
85 commit(false); 85 });
86 } 86 },
87 }); 87 addrow: function(rowid, rowdata, position, commit) {
88 }, 88 var data = 'insert=true&' + $.param(rowdata);
89 addrow: function (rowid, rowdata, position, commit) { 89 $.ajax({
90 var data = "insert=true&" + $.param(rowdata); 90 dataType: 'json',
91 $.ajax({ 91 url: url,
92 dataType: 'json', 92 cache: false,
93 url: url, 93 data: data,
94 cache: false, 94 type: 'POST',
95 data: data, 95 success: function(data, status, xhr) {
96 type: "POST", 96 commit(true);
97 success: function (data, status, xhr) { 97 location.reload(true);
98 commit(true); 98 },
99 location.reload( true ); 99 error: function(jqXHR, textStatus, errorThrown) {
100 }, 100 commit(false);
101 error: function(jqXHR, textStatus, errorThrown) { 101 }
102 commit(false); 102 });
103 } 103 },
104 }); 104 updaterow: function(rowid, rowdata, commit) {
105 }, 105 var data = 'update=true&' + $.param(rowdata);
106 updaterow: function (rowid, rowdata, commit) { 106 $.ajax({
107 var data = "update=true&" + $.param(rowdata); 107 dataType: 'json',
108 $.ajax({ 108 url: url,
109 dataType: 'json', 109 cache: false,
110 url: url, 110 data: data,
111 cache: false, 111 type: 'POST',
112 data: data, 112 success: function(data, status, xhr) {
113 type: "POST", 113 commit(true);
114 success: function (data, status, xhr) { 114 location.reload(true);
115 commit(true); 115 },
116 location.reload( true ); 116 error: function(jqXHR, textStatus, errorThrown) {
117 }, 117 commit(false);
118 error: function(jqXHR, textStatus, errorThrown) { 118 }
119 commit(false); 119 });
120 } 120 }
121 }); 121 },
122 } 122 dataAdapter = new $.jqx.dataAdapter(source),
123 }, 123 editrow = -1,
124 dataAdapter = new $.jqx.dataAdapter(source), 124
125 editrow = -1, 125 // Inline steps editor
126 126 editsteps = function(data) {
127 // Inline steps editor 127 var generaterow = function() {
128 editsteps = function (data) { 128 var row = {};
129 var generaterow = function () { 129 row['name'] = 'Stap 1';
130 var row = {}; 130 row['steptime'] = 12;
131 row["name"] = "Stap 1"; 131 row['resttime'] = 24;
132 row['steptime'] = 12; 132 row['target_lo'] = 22.0;
133 row['resttime'] = 24; 133 row['target_hi'] = 23.0;
134 row['target_lo'] = 22.0; 134 row['fridgemode'] = 0;
135 row['target_hi'] = 23.0; 135 return row;
136 row['fridgemode'] = 0; 136 };
137 return row; 137 var stepSource = {
138 }, 138 localdata: data.steps,
139 stepSource = { 139 datatype: 'local',
140 localdata: data.steps, 140 datafields: [
141 datatype: "local", 141 { name: 'name', type: 'string' },
142 datafields: [ 142 { name: 'steptime', type: 'float' },
143 { name: 'name', type: 'string' }, 143 { name: 'resttime', type: 'float' },
144 { name: 'steptime', type: 'float' }, 144 { name: 'target_lo', type: 'float' },
145 { name: 'resttime', type: 'float' }, 145 { name: 'target_hi', type: 'float' },
146 { name: 'target_lo', type: 'float' }, 146 { name: 'fridgemode', type: 'int' }
147 { name: 'target_hi', type: 'float' }, 147 ],
148 { name: 'fridgemode', type: 'int' } 148 addrow: function(rowid, rowdata, position, commit) {
149 ], 149 commit(true);
150 addrow: function (rowid, rowdata, position, commit) { 150 },
151 commit(true); 151 deleterow: function(rowid, commit) {
152 }, 152 commit(true);
153 deleterow: function (rowid, commit) { 153 }
154 commit(true); 154 },
155 } 155 stepAdapter = new $.jqx.dataAdapter(stepSource);
156 }, 156 $('#grid').jqxGrid({
157 stepAdapter = new $.jqx.dataAdapter(stepSource); 157 width: 800,
158 $("#grid").jqxGrid({ 158 height: 330,
159 width: 800, 159 source: stepAdapter,
160 height: 330, 160 theme: theme,
161 source: stepAdapter, 161 selectionmode: 'singlerow',
162 theme: theme, 162 editmode: 'selectedcell',
163 selectionmode: 'singlerow', 163 editable: true,
164 editmode: 'selectedcell', 164 showtoolbar: true,
165 editable: true, 165 rendertoolbar: function(toolbar) {
166 showtoolbar: true, 166 var container = $('<div style="margin: 5px;"></div>');
167 rendertoolbar: function (toolbar) { 167 toolbar.append(container);
168 var container = $("<div style='margin: 5px;'></div>"); 168 container.append('<input style="margin-left: 100px;" id="addrowbutton" type="button" value="Nieuwe stap" />');
169 toolbar.append(container); 169 container.append('<input style="margin-left: 290px;" id="deleterowbutton" type="button" value="Verwijder stap" />');
170 container.append('<input style="margin-left: 100px;" id="addrowbutton" type="button" value="Nieuwe stap" />'); 170 $('#addrowbutton').jqxButton({ template: 'primary', theme: theme, width: 150 });
171 container.append('<input style="margin-left: 290px;" id="deleterowbutton" type="button" value="Verwijder stap" />'); 171 $('#deleterowbutton').jqxButton({ template: 'danger', theme: theme, width: 150 });
172 $("#addrowbutton").jqxButton({ template: "primary", theme: theme, width: 150 }); 172 // create new row.
173 $("#deleterowbutton").jqxButton({ template: "danger", theme: theme, width: 150 }); 173 $('#addrowbutton').on('click', function() {
174 // create new row. 174 var datarow = generaterow();
175 $("#addrowbutton").on('click', function () { 175 $('#grid').jqxGrid('addrow', null, datarow);
176 var datarow = generaterow(); 176 });
177 $("#grid").jqxGrid('addrow', null, datarow); 177 // delete row.
178 }); 178 $('#deleterowbutton').on('click', function() {
179 // delete row. 179 var selectedrowindex = $('#grid').jqxGrid('getselectedrowindex'),
180 $("#deleterowbutton").on('click', function () { 180 rowscount = $('#grid').jqxGrid('getdatainformation').rowscount,
181 var selectedrowindex = $("#grid").jqxGrid('getselectedrowindex'), 181 id;
182 rowscount = $("#grid").jqxGrid('getdatainformation').rowscount, 182 if (selectedrowindex >= 0 && selectedrowindex < rowscount) {
183 id; 183 id = $('#grid').jqxGrid('getrowid', selectedrowindex);
184 if (selectedrowindex >= 0 && selectedrowindex < rowscount) { 184 $('#grid').jqxGrid('deleterow', id);
185 id = $("#grid").jqxGrid('getrowid', selectedrowindex); 185 }
186 $("#grid").jqxGrid('deleterow', id); 186 });
187 } 187 },
188 }); 188 columns: [
189 }, 189 { text: 'Stap naam', datafield: 'name' },
190 columns: [ 190 { text: 'Min. &deg;C', datafield: 'target_lo', width: 100, align: 'right', cellsalign: 'right', cellsformat: 'f1',
191 { text: 'Stap naam', datafield: 'name' }, 191 validation: function(cell, value) {
192 { text: 'Min. &deg;C', datafield: 'target_lo', width: 100, align: 'right', cellsalign: 'right', cellsformat: 'f1', 192 if (value < 0 || value > 50) {
193 validation: function (cell, value) { 193 return { result: false, message: 'De temperatuur moet tussen 0 en 50 zijn.' };
194 if (value < 0 || value > 40) { 194 }
195 return { result: false, message: "De temperatuur moet tussen 0 en 40 zijn." }; 195 return true;
196 } 196 }
197 return true; 197 },
198 } 198 { text: 'Max. &deg;C', datafield: 'target_hi', width: 100, align: 'right', cellsalign: 'right', cellsformat: 'f1',
199 }, 199 validation: function(cell, value) {
200 { text: 'Max. &deg;C', datafield: 'target_hi', width: 100, align: 'right', cellsalign: 'right', cellsformat: 'f1', 200 if (value < 0 || value > 50) {
201 validation: function (cell, value) { 201 return { result: false, message: 'De temperatuur moet tussen 0 en 50 zijn.' };
202 if (value < 0 || value > 40) { 202 }
203 return { result: false, message: "De temperatuur moet tussen 0 en 40 zijn." }; 203 return true;
204 } 204 }
205 return true; 205 },
206 } 206 { text: 'Koelkast', datafield: 'fridgemode', columntype: 'checkbox', width: 80 },
207 }, 207 { text: 'Stap tijd', datafield: 'steptime', width: 80, align: 'right', cellsalign: 'right',
208 { text: 'Koelkast', datafield: 'fridgemode', columntype: 'checkbox', width: 80 }, 208 validation: function(cell, value) {
209 { text: 'Stap tijd', datafield: 'steptime', width: 80, align: 'right', cellsalign: 'right', 209 if (value < 0 || value > 14400) {
210 validation: function (cell, value) { 210 return { result: false, message: 'De tijd moet tussen 0 en 14400 zijn.' };
211 if (value < 0 || value > 14400) { 211 }
212 return { result: false, message: "De tijd moet tussen 0 en 14400 zijn." }; 212 return true;
213 } 213 }
214 return true; 214 },
215 } 215 { text: 'Rust tijd', datafield: 'resttime', width: 80, align: 'right', cellsalign: 'right',
216 }, 216 validation: function(cell, value) {
217 { text: 'Rust tijd', datafield: 'resttime', width: 80, align: 'right', cellsalign: 'right', 217 if (value < 0 || value > 14400) {
218 validation: function (cell, value) { 218 return { result: false, message: 'De tijd moet tussen 0 en 14400 zijn.' };
219 if (value < 0 || value > 14400) { 219 }
220 return { result: false, message: "De tijd moet tussen 0 en 14400 zijn." }; 220 return true;
221 } 221 }
222 return true; 222 }
223 } 223 ]
224 } 224 });
225 ] 225 };
226 }); 226
227 }; 227 // initialize the input fields.
228 228 $('#name').jqxInput({ theme: theme, width: 640, height: 23 });
229 // initialize the input fields. 229 $('#inittemp_lo').jqxNumberInput(Spin1dec);
230 $("#name").jqxInput({ theme: theme, width: 640, height: 23 }); 230 $('#inittemp_lo').jqxNumberInput({ max: 40 });
231 $("#inittemp_lo").jqxNumberInput( Spin1dec ); 231 $('#inittemp_hi').jqxNumberInput(Spin1dec);
232 $("#inittemp_lo").jqxNumberInput({ max: 40 }); 232 $('#inittemp_hi').jqxNumberInput({ max: 40 });
233 $("#inittemp_hi").jqxNumberInput( Spin1dec ); 233 $('#fridgemode').jqxCheckBox({ theme: theme, height: 23, enableContainerClick: false });
234 $("#inittemp_hi").jqxNumberInput({ max: 40 }); 234
235 $("#fridgemode").jqxCheckBox({ theme: theme, height: 23, enableContainerClick: false }); 235 // initialize jqxGrid
236 236 $('#jqxgrid').jqxGrid({
237 // initialize jqxGrid 237 width: 1280,
238 $("#jqxgrid").jqxGrid({ 238 height: 630,
239 width: 1280, 239 source: dataAdapter,
240 height: 630, 240 theme: theme,
241 source: dataAdapter, 241 showstatusbar: true,
242 theme: theme, 242 renderstatusbar: function(statusbar) {
243 showstatusbar: true, 243 var addButton, container = $('<div style="overflow: hidden; position: relative; margin: 5px;"></div>');
244 renderstatusbar: function (statusbar) { 244 addButton = $('<div style="float: right; margin-right: 15px;"><img style="position: relative; margin-top: 2px;" ' +
245 var addButton, container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); 245 'src="images/add.png"/><span style="margin-left: 4px; position: relative; top: -3px;">Nieuw</span></div>');
246 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;'>Nieuw</span></div>"); 246 container.append(addButton);
247 container.append(addButton); 247 statusbar.append(container);
248 statusbar.append(container); 248 addButton.jqxButton({ theme: theme, width: 90, height: 20 });
249 addButton.jqxButton({ theme: theme, width: 90, height: 20 }); 249 // add new row.
250 // add new row. 250 addButton.click(function(event) {
251 addButton.click(function (event) { 251 editrow = -1;
252 editrow = -1; 252 $('#name').val('Nieuw vergist profiel');
253 $("#name").val('Nieuw vergist profiel'); 253 dataRecord.uuid = '';
254 dataRecord.uuid = ''; 254 $('#inittemp_lo').val(20.0);
255 $("#inittemp_lo").val(20.0); 255 $('#inittemp_hi').val(20.0);
256 $("#inittemp_hi").val(20.0); 256 $('#fridgemode').val(0);
257 $("#fridgemode").val(0); 257 dataRecord.totalsteps = 0;
258 dataRecord.totalsteps = 0; 258 dataRecord.duration = 0;
259 dataRecord.duration = 0; 259 editsteps('');
260 editsteps(''); 260 $('#popupWindow').jqxWindow('open');
261 $("#popupWindow").jqxWindow('open'); 261 });
262 }); 262 },
263 }, 263 filterable: false,
264 filterable: false, 264 columns: [
265 columns: [ 265 { text: 'Vergisting profiel', datafield: 'name' },
266 { text: 'Vergisting profiel', datafield: 'name' }, 266 { text: 'Min. start &deg;C', datafield: 'inittemp_lo', width: 150, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
267 { text: 'Min. start &deg;C', datafield: 'inittemp_lo', width: 150, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, 267 { text: 'Max. start &deg;C', datafield: 'inittemp_hi', width: 150, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
268 { text: 'Max. start &deg;C', datafield: 'inittemp_hi', width: 150, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, 268 { text: 'Stappen', datafield: 'totalsteps', width: 80, align: 'right', cellsalign: 'right' },
269 { text: 'Stappen', datafield: 'totalsteps', width: 80, align: 'right', cellsalign: 'right' }, 269 { text: 'Tijdsduur', datafield: 'duration', width: 150, align: 'right',
270 { text: 'Tijdsduur', datafield: 'duration', width: 150, align: 'right', 270 cellsrenderer: function(row, columnfield, value, defaulthtml, column) {
271 cellsrenderer: function (row, columnfield, value, defaulthtml, column) { 271 var show, days, hours;
272 var show, days, hours; 272 if (value < 24) {
273 if (value < 24) { 273 show = value + ' uur';
274 show = value + ' uur'; 274 } else {
275 } else { 275 days = Math.floor(value / 24);
276 days = Math.floor(value / 24); 276 hours = value % 24;
277 hours = value % 24; 277 if (days == 1)
278 if (days == 1) 278 show = days + ' dag, ' + hours + ' uur';
279 show = days + ' dag, ' + hours + ' uur'; 279 else
280 else 280 show = days + ' dagen, ' + hours + ' uur';
281 show = days + ' dagen, ' + hours + ' uur'; 281 }
282 } 282 return '<span style="margin: 3px; margin-top: 6px; float: right;">' + show + '</span>';
283 return "<span style='margin: 3px; margin-top: 6px; float: right;'>" + show + "</span>"; 283 }
284 } 284 },
285 }, 285 { text: '', datafield: 'Edit', width: 100, align: 'center', columntype: 'button', cellsrenderer:
286 { text: '', datafield: 'Edit', width: 100, align: 'center', columntype: 'button', cellsrenderer: 286 function() {
287 function () { 287 return 'Wijzig';
288 return "Wijzig"; 288 }, buttonclick: function(row) {
289 }, buttonclick: function (row) { 289 editrow = row;
290 editrow = row; 290 // get the clicked row's data and initialize the input fields.
291 // get the clicked row's data and initialize the input fields. 291 dataRecord = $('#jqxgrid').jqxGrid('getrowdata', editrow);
292 dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow); 292 $('#name').val(dataRecord.name);
293 $("#name").val(dataRecord.name); 293 $('#inittemp_lo').val(parseFloat(dataRecord.inittemp_lo));
294 $("#inittemp_lo").val(parseFloat(dataRecord.inittemp_lo)); 294 $('#inittemp_hi').val(parseFloat(dataRecord.inittemp_hi));
295 $("#inittemp_hi").val(parseFloat(dataRecord.inittemp_hi)); 295 $('#fridgemode').val(parseFloat(dataRecord.fridgemode));
296 $("#fridgemode").val(parseFloat(dataRecord.fridgemode)); 296 editsteps(dataRecord);
297 editsteps(dataRecord); 297 // show the popup window.
298 // show the popup window. 298 $('#popupWindow').jqxWindow('open');
299 $("#popupWindow").jqxWindow('open'); 299 }
300 } 300 }
301 } 301 ]
302 ] 302 });
303 }); 303 // initialize the popup window and buttons.
304 // initialize the popup window and buttons. 304 $('#popupWindow').jqxWindow({
305 $("#popupWindow").jqxWindow({ 305 width: 1050,
306 width: 1050, 306 height: 550,
307 height: 550, 307 position: { x: 110, y: 30 },
308 position: { x: 110, y: 30 }, 308 resizable: false,
309 resizable: false, 309 theme: theme,
310 theme: theme, 310 isModal: true,
311 isModal: true, 311 autoOpen: false,
312 autoOpen: false, 312 cancelButton: $('#Cancel'),
313 cancelButton: $("#Cancel"), 313 modalOpacity: 0.40
314 modalOpacity: 0.40 314 });
315 }); 315 $('#popupWindow').on('open', function() {
316 $("#popupWindow").on('open', function () { 316 $('#name').jqxInput('selectAll');
317 $("#name").jqxInput('selectAll'); 317 });
318 }); 318 $('#Delete').jqxButton({ template: 'danger', width: '90px', theme: theme });
319 $("#Delete").jqxButton({ template: "danger", width: '90px', theme: theme }); 319 $('#Delete').click(function() {
320 $("#Delete").click(function () { 320 if (editrow >= 0) {
321 if (editrow >= 0) { 321 // Open a popup to confirm this action.
322 // Open a popup to confirm this action. 322 $('#eventWindow').jqxWindow('open');
323 $('#eventWindow').jqxWindow('open'); 323 $('#delOk').click(function() {
324 $("#delOk").click(function () { 324 var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
325 var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); 325 $('#jqxgrid').jqxGrid('deleterow', rowID);
326 $("#jqxgrid").jqxGrid('deleterow', rowID); 326 });
327 }); 327 }
328 } 328 $('#popupWindow').jqxWindow('hide');
329 $("#popupWindow").jqxWindow('hide'); 329 });
330 }); 330 $('#Cancel').jqxButton({ template: 'primary', width: '90px', theme: theme });
331 $("#Cancel").jqxButton({ template: "primary", width: '90px', theme: theme }); 331 $('#Save').jqxButton({ template: 'success', width: '90px', theme: theme });
332 $("#Save").jqxButton({ template: "success", width: '90px', theme: theme }); 332 // update the edited row when the user clicks the 'Save' button.
333 // update the edited row when the user clicks the 'Save' button. 333 $('#Save').click(function() {
334 $("#Save").click(function () { 334 var row, rowID = -1, steprows = $('#grid').jqxGrid('getrows');
335 var row, rowID = -1, steprows = $('#grid').jqxGrid('getrows'); 335 if (editrow >= 0) {
336 if (editrow >= 0) { 336 rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
337 rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); 337 }
338 } 338 row = {
339 row = { 339 record: rowID,
340 record: rowID, 340 uuid: dataRecord.uuid,
341 uuid: dataRecord.uuid, 341 name: $('#name').val(),
342 name: $("#name").val(), 342 inittemp_lo: parseFloat($('#inittemp_lo').jqxNumberInput('decimal')),
343 inittemp_lo: parseFloat($("#inittemp_lo").jqxNumberInput('decimal')), 343 inittemp_hi: parseFloat($('#inittemp_hi').jqxNumberInput('decimal')),
344 inittemp_hi: parseFloat($("#inittemp_hi").jqxNumberInput('decimal')), 344 fridgemode: $('#fridgemode').val(),
345 fridgemode: $("#fridgemode").val(), 345 steps: steprows
346 steps: steprows 346 };
347 }; 347 if (editrow >= 0) {
348 if (editrow >= 0) { 348 $('#jqxgrid').jqxGrid('updaterow', rowID, row);
349 $('#jqxgrid').jqxGrid('updaterow', rowID, row); 349 } else {
350 } else { 350 $('#jqxgrid').jqxGrid('addrow', null, row);
351 $('#jqxgrid').jqxGrid('addrow', null, row); 351 }
352 } 352 $('#popupWindow').jqxWindow('hide');
353 $("#popupWindow").jqxWindow('hide'); 353 });
354 }); 354 createDelElements();
355 createDelElements();
356 }); 355 });
357 356

mercurial