185 } |
185 } |
186 }, |
186 }, |
187 error: function(jqXHR, textStatus, errorThrown) { |
187 error: function(jqXHR, textStatus, errorThrown) { |
188 } |
188 } |
189 }); |
189 }); |
|
190 $('#jqxgrid').jqxGrid('updatebounddata'); |
190 } else { |
191 } else { |
191 console.log('Add wrong type'); |
192 console.log('Add wrong type'); |
192 } |
193 } |
193 }); |
194 }); |
194 }); |
195 }); |
195 }, |
196 }, |
196 columns: [ |
197 columns: [ |
197 { text: 'Address', datafield: 'address', width: 200 }, |
198 { text: 'Address', datafield: 'address', width: 200 }, |
198 { text: 'Subdevice', datafield: 'subdevice', width: 100 }, |
199 { text: 'Sub', datafield: 'subdevice', width: 60 }, |
|
200 { text: 'Type', datafield: 'type', width: 100 }, |
199 { text: 'Direction', datafield: 'direction', width: 120 }, |
201 { text: 'Direction', datafield: 'direction', width: 120 }, |
200 { text: 'Value', datafield: 'value', width: 80 }, |
202 { text: 'Value', datafield: 'value', width: 80 }, |
201 { text: 'Description', datafield: 'description' }, |
203 { text: 'Description', datafield: 'description' }, |
202 { text: 'Last change', datafield: 'timestamp', width: 200, |
204 { text: 'Last change', datafield: 'timestamp', width: 200, |
203 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
205 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
251 $('#Delete').click(function() { |
253 $('#Delete').click(function() { |
252 if (editrow >= 0) { |
254 if (editrow >= 0) { |
253 // Open a popup to confirm this action. |
255 // Open a popup to confirm this action. |
254 $('#eventWindow').jqxWindow('open'); |
256 $('#eventWindow').jqxWindow('open'); |
255 $('#delOk').click(function() { |
257 $('#delOk').click(function() { |
256 var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); |
258 console.log('Del ' + $('#dev_uuid').val()); |
257 $('#jqxgrid').jqxGrid('deleterow', rowID); |
259 var data, |
|
260 data = 'del=true&uuid=' + $('#dev_uuid').val(); |
|
261 console.log(data); |
|
262 $.ajax({ |
|
263 dataType: 'json', |
|
264 url: url, |
|
265 cache: false, |
|
266 data: data, |
|
267 type: 'POST', |
|
268 success: function(data) { |
|
269 if (data.error) { |
|
270 console.log('del: ' + data.msg); |
|
271 alert('Error: ' + data.msg); |
|
272 } else { |
|
273 console.log('del: success'); |
|
274 } |
|
275 }, |
|
276 error: function(jqXHR, textStatus, errorThrown) {} |
|
277 }); |
|
278 $('#jqxgrid').jqxGrid('updatebounddata'); |
|
279 // var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); |
|
280 // $('#jqxgrid').jqxGrid('deleterow', rowID); |
258 }); |
281 }); |
259 } |
282 } |
260 $('#popupWindow').jqxWindow('hide'); |
283 $('#popupWindow').jqxWindow('hide'); |
261 }); |
284 }); |
262 $('#Cancel').jqxButton({ template: 'primary', width: '90px', theme: theme }); |
285 $('#Cancel').jqxButton({ template: 'primary', width: '90px', theme: theme }); |