www/js/set_simulators.js

changeset 715
f5d85af156ab
parent 714
24749c296a50
child 716
5c30c8ef83a8
equal deleted inserted replaced
714:24749c296a50 715:f5d85af156ab
269 autoOpen: false, 269 autoOpen: false,
270 cancelButton: $('#Cancel'), 270 cancelButton: $('#Cancel'),
271 modalOpacity: 0.40 271 modalOpacity: 0.40
272 }); 272 });
273 $('#popupWindow').on('open', function() { 273 $('#popupWindow').on('open', function() {
274 $('#dev_description').jqxInput('selectAll'); 274 $('#name').jqxInput('selectAll');
275 }); 275 });
276 $('#Delete').jqxButton({ template: 'danger', width: '90px', theme: theme }); 276 $('#Delete').jqxButton({ template: 'danger', width: '90px', theme: theme });
277 $('#Delete').click(function() { 277 $('#Delete').click(function() {
278 if (editrow >= 0) { 278 if (editrow >= 0) {
279 // Open a popup to confirm this action. 279 // Open a popup to confirm this action.
306 $('#Save').jqxButton({ template: 'success', width: '90px', theme: theme }); 306 $('#Save').jqxButton({ template: 'success', width: '90px', theme: theme });
307 $('#Save').click(function() { 307 $('#Save').click(function() {
308 var data, 308 var data,
309 row = { 309 row = {
310 uuid: dataRecord.uuid, 310 uuid: dataRecord.uuid,
311 type: $('#dev_type').val(), 311 name: $('#name').val(),
312 direction: $('#dev_direction').val(), 312 volume_air: parseInt($('#volume_air').jqxNumberInput('decimal')),
313 value: parseInt($('#dev_value').jqxNumberInput('decimal')), 313 volume_beer: parseInt($('#volume_beer').jqxNumberInput('decimal')),
314 offset: parseInt($('#dev_offset').jqxNumberInput('decimal')), 314 room_temperature: parseFloat($('#room_temperature').jqxNumberInput('decimal')),
315 present: $('#dev_present').val(), 315 room_humidity: parseFloat($('#room_humidity').jqxNumberInput('decimal')),
316 address: $('#dev_address').val(), 316 air_present: $('#air_present').val(),
317 subdevice: parseInt($('#dev_subdevice').jqxNumberInput('decimal')), 317 beer_present: $('#beer_present').val(),
318 gpiopin: parseInt($('#dev_gpiopin').jqxNumberInput('val')), 318 beer_present2: $('#beer_present2').val(),
319 description: $('#dev_description').val(), 319 chiller_present: $('#chiller_present').val(),
320 comment: $('#dev_comment').val() 320 cooler_temp: parseFloat($('#cooler_temp').jqxNumberInput('decimal')),
321 cooler_time: parseInt($('#cooler_time').jqxNumberInput('decimal')),
322 cooler_size: parseFloat($('#cooler_size').jqxNumberInput('decimal')),
323 cooler_present: $('#cooler_present').val(),
324 cooler_power: parseInt($('#cooler_power').jqxNumberInput('decimal')),
325 heater_temp: parseFloat($('#heater_temp').jqxNumberInput('decimal')),
326 heater_time: parseInt($('#heater_time').jqxNumberInput('decimal')),
327 heater_size: parseFloat($('#heater_size').jqxNumberInput('decimal')),
328 heater_present: $('#heater_present').val(),
329 heater_power: parseInt($('#heater_power').jqxNumberInput('decimal')),
330 fan_present: $('#fan_present').val(),
331 fan_power: parseInt($('#fan_power').jqxNumberInput('decimal')),
332 light_present: $('#light_present').val(),
333 light_power: parseInt($('#light_power').jqxNumberInput('decimal')),
334 frigo_isolation: parseFloat($('#frigo_isolation').jqxNumberInput('decimal'))
321 }; 335 };
322 data = 'update=true&' + $.param(row); 336 data = 'update=true&' + $.param(row);
323 console.log(data); 337 console.log(data);
324 $.ajax({ 338 $.ajax({
325 dataType: 'json', 339 dataType: 'json',
331 if (data.error) { 345 if (data.error) {
332 console.log('update: ' + data.msg); 346 console.log('update: ' + data.msg);
333 alert('Error: ' + data.msg); 347 alert('Error: ' + data.msg);
334 } else { 348 } else {
335 console.log('update: success'); 349 console.log('update: success');
350 $('#jqxgrid').jqxGrid('updatebounddata');
336 } 351 }
337 }, 352 },
338 error: function(jqXHR, textStatus, errorThrown) {} 353 error: function(jqXHR, textStatus, errorThrown) {}
339 }); 354 });
340 $('#popupWindow').jqxWindow('hide'); 355 $('#popupWindow').jqxWindow('hide');

mercurial