www-thermferm/js/maintenance_panel.js

changeset 132
8bd209d1c020
parent 131
528dc0bb81ab
child 134
f05601490415
equal deleted inserted replaced
131:528dc0bb81ab 132:8bd209d1c020
19 * along with ThermFerm; see the file COPYING. If not, write to the Free 19 * along with ThermFerm; see the file COPYING. If not, write to the Free
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 $(document).ready(function () { 23 $(document).ready(function () {
24
25 var data = {};
26 var theme = 'ui-redmond';
27
24 /* 28 /*
25 * 1-Wire bus 29 * 1-Wire bus
26 */ 30 */
27 var source_bus = { 31 var source_bus = {
28 datatype: "json", 32 datatype: "json",
36 }; 40 };
37 var dataAdapter_bus = new $.jqx.dataAdapter(source_bus); 41 var dataAdapter_bus = new $.jqx.dataAdapter(source_bus);
38 $("#jqxgrid_bus").jqxGrid( { 42 $("#jqxgrid_bus").jqxGrid( {
39 width: 770, height: 280, 43 width: 770, height: 280,
40 source: dataAdapter_bus, 44 source: dataAdapter_bus,
41 theme: 'ui-redmond', 45 theme: theme,
42 columnsresize: true, 46 columnsresize: true,
43 columns: [ 47 columns: [
44 { text: 'Address', datafield: 'Address', width: 150 }, 48 { text: 'Address', datafield: 'Address', width: 150 },
45 { text: 'References', datafield: 'Refcnt', width: 100 }, 49 { text: 'References', datafield: 'Refcnt', width: 100 },
46 { text: 'Chipset', datafield: 'Chip', width: 120 }, 50 { text: 'Chipset', datafield: 'Chip', width: 120 },
56 datafields: [ 60 datafields: [
57 { name: 'UUID', type: 'string' }, 61 { name: 'UUID', type: 'string' },
58 { name: 'Name', type: 'string' }, 62 { name: 'Name', type: 'string' },
59 { name: 'Steps', type: 'int' } 63 { name: 'Steps', type: 'int' }
60 ], 64 ],
61 url: 'getprofiles.php' 65 url: 'getprofiles.php',
66 updaterow: function (rowid, rowdata, commit) {
67 // synchronize with the server - send update command
68 var data = "update=true&UUID=" + rowdata.UUID + "&Name=" + rowdata.Name;
69 $.ajax({
70 dataType: 'json',
71 url: 'getprofiles.php',
72 data: data,
73 success: function (data, status, xhr) {
74 // update command is executed.
75 commit(true);
76 },
77 error: function () {
78 // cancel changes.
79 commit(false);
80 }
81 });
82 }
62 }; 83 };
63 var dataAdapter_profiles = new $.jqx.dataAdapter(source_profiles); 84 var dataAdapter_profiles = new $.jqx.dataAdapter(source_profiles);
64 $("#jqxgrid_profiles").jqxGrid( { 85 $("#jqxgrid_profiles").jqxGrid( {
65 width: 770, height: 280, 86 width: 770, height: 280,
87 selectionmode: 'singlecell',
66 source: dataAdapter_profiles, 88 source: dataAdapter_profiles,
67 theme: 'ui-redmond', 89 theme: theme,
68 columnsresize: true, 90 columnsresize: true,
69 editable: true, 91 editable: true,
70 columns: [ 92 columns: [
71 { text: 'UUID', editable: false, datafield: 'UUID', width: 280 }, 93 { text: 'UUID', editable: false, datafield: 'UUID', width: 280 },
72 { text: 'Name', datafield: 'Name', minwidth: 120 }, 94 { text: 'Name', datafield: 'Name', minwidth: 120 },
73 { text: 'Steps', datafield: 'Steps', width: 50 } 95 { text: 'Steps', editable: false, datafield: 'Steps', width: 50 }
74 ] 96 ]
75 }); 97 });
76 98
77 /* 99 /*
78 * Units 100 * Units
88 }; 110 };
89 var dataAdapter_units = new $.jqx.dataAdapter(source_units); 111 var dataAdapter_units = new $.jqx.dataAdapter(source_units);
90 $("#jqxgrid_units").jqxGrid( { 112 $("#jqxgrid_units").jqxGrid( {
91 width: 770, height: 280, 113 width: 770, height: 280,
92 source: dataAdapter_units, 114 source: dataAdapter_units,
93 theme: 'ui-redmond', 115 theme: theme,
94 columnsresize: true, 116 columnsresize: true,
95 editable: true, 117 editable: true,
96 columns: [ 118 columns: [
97 { text: 'UUID', editable: false, datafield: 'UUID', width: 280 }, 119 { text: 'UUID', editable: false, datafield: 'UUID', width: 280 },
98 { text: 'Name', datafield: 'Name', minwidth: 120 }, 120 { text: 'Name', datafield: 'Name', minwidth: 120 },

mercurial