www-thermferm/js/maintenance_panel.js

changeset 132
8bd209d1c020
parent 131
528dc0bb81ab
child 134
f05601490415
--- a/www-thermferm/js/maintenance_panel.js	Thu Jul 24 20:45:15 2014 +0200
+++ b/www-thermferm/js/maintenance_panel.js	Thu Jul 24 23:11:28 2014 +0200
@@ -21,6 +21,10 @@
  *****************************************************************************/
 
 $(document).ready(function () {
+
+    var data = {};
+    var theme = 'ui-redmond';
+
     /*
      * 1-Wire bus
      */
@@ -38,7 +42,7 @@
     $("#jqxgrid_bus").jqxGrid( {
 	width: 770, height: 280,
 	source: dataAdapter_bus,
-	theme: 'ui-redmond',
+	theme: theme,
 	columnsresize: true,
 	columns: [
 	    { text: 'Address', datafield: 'Address', width: 150 },
@@ -58,19 +62,37 @@
             { name: 'Name', type: 'string' },
             { name: 'Steps', type: 'int' }
         ],
-        url: 'getprofiles.php'
+        url: 'getprofiles.php',
+	updaterow: function (rowid, rowdata, commit) {
+	    // synchronize with the server - send update command
+	    var data = "update=true&UUID=" + rowdata.UUID + "&Name=" + rowdata.Name;
+	    $.ajax({
+		dataType: 'json',
+		url: 'getprofiles.php',
+		data: data,
+		success: function (data, status, xhr) {
+		    // update command is executed.
+		    commit(true);
+		},
+		error: function () {
+		    // cancel changes.
+		    commit(false);
+		}
+	    });
+	}
     };
     var dataAdapter_profiles = new $.jqx.dataAdapter(source_profiles);
     $("#jqxgrid_profiles").jqxGrid( {
         width: 770, height: 280,
+	selectionmode: 'singlecell',
         source: dataAdapter_profiles,
-        theme: 'ui-redmond',
+        theme: theme,
         columnsresize: true,
 	editable: true,
         columns: [
             { text: 'UUID', editable: false, datafield: 'UUID', width: 280 },
             { text: 'Name', datafield: 'Name', minwidth: 120 },
-            { text: 'Steps', datafield: 'Steps', width: 50 }
+            { text: 'Steps', editable: false, datafield: 'Steps', width: 50 }
         ]
     });
 
@@ -90,7 +112,7 @@
     $("#jqxgrid_units").jqxGrid( {
         width: 770, height: 280,
         source: dataAdapter_units,
-        theme: 'ui-redmond',
+        theme: theme,
         columnsresize: true,
 	editable: true,
         columns: [

mercurial