49 datatype: "json", |
49 datatype: "json", |
50 cache: false, |
50 cache: false, |
51 datafields: [ |
51 datafields: [ |
52 { name: 'record', type: 'number' }, |
52 { name: 'record', type: 'number' }, |
53 { name: 'name', type: 'string' }, |
53 { name: 'name', type: 'string' }, |
54 { name: 'grain_temp', type: 'float' }, |
|
55 { name: 'tun_temp', type: 'float' }, |
|
56 { name: 'sparge_temp', type: 'float' }, |
|
57 { name: 'ph', type: 'float' }, |
|
58 { name: 'tun_weight', type: 'float' }, |
|
59 { name: 'tun_specific_heat', type: 'float' }, |
|
60 { name: 'notes', type: 'string' }, |
54 { name: 'notes', type: 'string' }, |
61 { name: 'equip_adjust', type: 'bool' }, |
|
62 { name: 'steps', type: 'string' } |
55 { name: 'steps', type: 'string' } |
63 ], |
56 ], |
64 id: 'record', |
57 id: 'record', |
65 url: url, |
58 url: url, |
66 deleterow: function (rowid, commit) { |
59 deleterow: function (rowid, commit) { |
112 }); |
105 }); |
113 } |
106 } |
114 }; |
107 }; |
115 // initialize the input fields. |
108 // initialize the input fields. |
116 $("#name").jqxInput({ theme: theme, width: 250, height: 23 }); |
109 $("#name").jqxInput({ theme: theme, width: 250, height: 23 }); |
117 $("#grain_temp").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); |
|
118 $("#tun_temp").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); |
|
119 $("#sparge_temp").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); |
|
120 $("#ph").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); |
|
121 $("#tun_weight").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); |
|
122 $("#tun_specific_heat").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); |
|
123 |
|
124 $("#notes").jqxInput({ theme: theme, width: 640, height: 100 }); |
110 $("#notes").jqxInput({ theme: theme, width: 640, height: 100 }); |
125 $("#equip_adjust").jqxCheckBox({ theme: theme, width: 120, height: 23 }); |
|
126 var dataAdapter = new $.jqx.dataAdapter(source); |
111 var dataAdapter = new $.jqx.dataAdapter(source); |
127 var editrow = -1; |
112 var editrow = -1; |
128 // initialize jqxGrid |
113 // initialize jqxGrid |
129 $("#jqxgrid").jqxGrid({ |
114 $("#jqxgrid").jqxGrid({ |
130 width: 1280, |
115 width: 1280, |
142 // add new row. |
127 // add new row. |
143 addButton.click(function (event) { |
128 addButton.click(function (event) { |
144 editrow = -1; |
129 editrow = -1; |
145 $("#popupWindow").jqxWindow({ position: { x: 230, y: 30 } }); |
130 $("#popupWindow").jqxWindow({ position: { x: 230, y: 30 } }); |
146 $("#name").val(''); |
131 $("#name").val(''); |
147 $("#grain_temp").val(''); |
|
148 $("#tun_temp").val(''); |
|
149 $("#sparge_temp").val(''); |
|
150 $("#ph").val(''); |
|
151 $("#tun_weight").val(''); |
|
152 $("#tun_specific_heat").val(''); |
|
153 $("#equip_adjust").val(''); |
|
154 $("#notes").val(''); |
132 $("#notes").val(''); |
155 $("#popupWindow").jqxWindow('open'); |
133 $("#popupWindow").jqxWindow('open'); |
156 }); |
134 }); |
157 }, |
135 }, |
158 filterable: true, |
136 filterable: true, |
167 editrow = row; |
145 editrow = row; |
168 $("#popupWindow").jqxWindow({ position: { x: 230, y: 30 } }); |
146 $("#popupWindow").jqxWindow({ position: { x: 230, y: 30 } }); |
169 // get the clicked row's data and initialize the input fields. |
147 // get the clicked row's data and initialize the input fields. |
170 var dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow); |
148 var dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow); |
171 $("#name").val(dataRecord.name); |
149 $("#name").val(dataRecord.name); |
172 $("#grain_temp").val(dataRecord.grain_temp); |
|
173 $("#tun_temp").val(dataRecord.tun_temp); |
|
174 $("#sparge_temp").val(dataRecord.sparge_temp); |
|
175 $("#ph").val(dataRecord.ph); |
|
176 $("#tun_weight").val(dataRecord.tun_weight); |
|
177 $("#tun_specific_heat").val(dataRecord.tun_specific_heat); |
|
178 $("#equip_adjust").val(dataRecord.equip_adjust); |
|
179 $("#notes").val(dataRecord.notes); |
150 $("#notes").val(dataRecord.notes); |
180 // show the popup window. |
151 // show the popup window. |
181 $("#popupWindow").jqxWindow('open'); |
152 $("#popupWindow").jqxWindow('open'); |
182 } |
153 } |
183 } |
154 } |
209 if (editrow >= 0) { |
180 if (editrow >= 0) { |
210 var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); |
181 var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); |
211 var row = { |
182 var row = { |
212 record: rowID, |
183 record: rowID, |
213 name: $("#name").val(), |
184 name: $("#name").val(), |
214 grain_temp: parseFloat($("#grain_temp").jqxNumberInput('decimal')), |
|
215 tun_temp: parseFloat($("#tun_temp").jqxNumberInput('decimal')), |
|
216 sparge_temp: parseFloat($("#sparge_temp").jqxNumberInput('decimal')), |
|
217 ph: parseFloat($("#ph").jqxNumberInput('decimal')), |
|
218 tun_weight: parseFloat($("#tun_weight").jqxNumberInput('decimal')), |
|
219 tun_specific_heat: parseFloat($("#tun_specific_heat").jqxNumberInput('decimal')), |
|
220 equip_adjust: $("equip_adjust").val(), |
|
221 notes: $("#notes").val() |
185 notes: $("#notes").val() |
222 }; |
186 }; |
223 $('#jqxgrid').jqxGrid('updaterow', rowID, row); |
187 $('#jqxgrid').jqxGrid('updaterow', rowID, row); |
224 $("#popupWindow").jqxWindow('hide'); |
188 $("#popupWindow").jqxWindow('hide'); |
225 } else { |
189 } else { |
226 // Insert a record |
190 // Insert a record |
227 var newrow = { |
191 var newrow = { |
228 record: -1, |
192 record: -1, |
229 name: $("#name").val(), |
193 name: $("#name").val(), |
230 grain_temp: parseFloat($("#grain_temp").jqxNumberInput('decimal')), |
|
231 tun_temp: parseFloat($("#tun_temp").jqxNumberInput('decimal')), |
|
232 sparge_temp: parseFloat($("#sparge_temp").jqxNumberInput('decimal')), |
|
233 ph: parseFloat($("#ph").jqxNumberInput('decimal')), |
|
234 tun_weight: parseFloat($("#tun_weight").jqxNumberInput('decimal')), |
|
235 tun_specific_heat: parseFloat($("#tun_specific_heat").jqxNumberInput('decimal')), |
|
236 equip_adjust: $("equip_adjust").val(), |
|
237 notes: $("#notes").val() |
194 notes: $("#notes").val() |
238 }; |
195 }; |
239 $('#jqxgrid').jqxGrid('addrow', null, newrow); |
196 $('#jqxgrid').jqxGrid('addrow', null, newrow); |
240 $("#popupWindow").jqxWindow('hide'); |
197 $("#popupWindow").jqxWindow('hide'); |
241 } |
198 } |