126 error: function(jqXHR, textStatus, errorThrown) { |
126 error: function(jqXHR, textStatus, errorThrown) { |
127 commit(false); |
127 commit(false); |
128 } |
128 } |
129 }); |
129 }); |
130 } |
130 } |
131 }; |
131 }, |
|
132 dataAdapter = new $.jqx.dataAdapter(source), |
|
133 editrow = -1; |
|
134 |
132 // initialize the input fields. |
135 // initialize the input fields. |
133 $("#name").jqxInput({ theme: theme, width: 640, height: 23 }); |
136 $("#name").jqxInput({ theme: theme, width: 640, height: 23 }); |
134 $("#notes").jqxInput({ theme: theme, width: 800, height: 100 }); |
137 $("#notes").jqxInput({ theme: theme, width: 800, height: 100 }); |
135 $("#calcium").jqxNumberInput( Spin1dec ); |
138 $("#calcium").jqxNumberInput( Spin1dec ); |
136 $("#bicarbonate").jqxNumberInput( Spin1dec ); |
139 $("#bicarbonate").jqxNumberInput( Spin1dec ); |
139 $("#sodium").jqxNumberInput( Spin1dec ); |
142 $("#sodium").jqxNumberInput( Spin1dec ); |
140 $("#magnesium").jqxNumberInput( Spin1dec ); |
143 $("#magnesium").jqxNumberInput( Spin1dec ); |
141 $("#ph").jqxNumberInput( Spin2pH ); |
144 $("#ph").jqxNumberInput( Spin2pH ); |
142 $("#total_alkalinity").jqxNumberInput( Spin1dec ); |
145 $("#total_alkalinity").jqxNumberInput( Spin1dec ); |
143 |
146 |
144 var dataAdapter = new $.jqx.dataAdapter(source), |
|
145 editrow = -1; |
|
146 // initialize jqxGrid |
147 // initialize jqxGrid |
147 $("#jqxgrid").jqxGrid({ |
148 $("#jqxgrid").jqxGrid({ |
148 width: 1280, |
149 width: 1280, |
149 height: 630, |
150 height: 630, |
150 source: dataAdapter, |
151 source: dataAdapter, |
151 theme: theme, |
152 theme: theme, |
152 showstatusbar: true, |
153 showstatusbar: true, |
153 renderstatusbar: function (statusbar) { |
154 renderstatusbar: function (statusbar) { |
154 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
155 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"), |
155 var addButton = $("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>"); |
156 addButton = $("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>"); |
156 container.append(addButton); |
157 container.append(addButton); |
157 statusbar.append(container); |
158 statusbar.append(container); |
158 addButton.jqxButton({ theme: theme, width: 90, height: 20 }); |
159 addButton.jqxButton({ theme: theme, width: 90, height: 20 }); |
159 // add new row. |
160 // add new row. |
160 addButton.click(function (event) { |
161 addButton.click(function (event) { |
247 }); |
248 }); |
248 $("#Cancel").jqxButton({ template: "primary", width: '90px', theme: theme }); |
249 $("#Cancel").jqxButton({ template: "primary", width: '90px', theme: theme }); |
249 $("#Save").jqxButton({ template: "success", width: '90px', theme: theme }); |
250 $("#Save").jqxButton({ template: "success", width: '90px', theme: theme }); |
250 // update the edited row when the user clicks the 'Save' button. |
251 // update the edited row when the user clicks the 'Save' button. |
251 $("#Save").click(function () { |
252 $("#Save").click(function () { |
252 var rowID = -1; |
253 var row, rowID = -1; |
253 if (editrow >= 0) { |
254 if (editrow >= 0) { |
254 rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); |
255 rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); |
255 } |
256 } |
256 var row = { |
257 row = { |
257 record: rowID, |
258 record: rowID, |
258 name: $("#name").val(), |
259 name: $("#name").val(), |
259 calcium: parseFloat($("#calcium").jqxNumberInput('decimal')), |
260 calcium: parseFloat($("#calcium").jqxNumberInput('decimal')), |
260 bicarbonate: parseFloat($("#bicarbonate").jqxNumberInput('decimal')), |
261 bicarbonate: parseFloat($("#bicarbonate").jqxNumberInput('decimal')), |
261 sulfate: parseFloat($("#sulfate").jqxNumberInput('decimal')), |
262 sulfate: parseFloat($("#sulfate").jqxNumberInput('decimal')), |