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: 320, height: 23 }); |
136 $("#name").jqxInput({ theme: theme, width: 320, height: 23 }); |
134 $("#category").jqxInput({ theme: theme, width: 320, height: 23 }); |
137 $("#category").jqxInput({ theme: theme, width: 320, height: 23 }); |
135 $("#category_number").jqxNumberInput( PosInt ); |
138 $("#category_number").jqxNumberInput( PosInt ); |
136 $("#style_letter").jqxInput({ theme: theme, width: 250, height: 23 }); |
139 $("#style_letter").jqxInput({ theme: theme, width: 250, height: 23 }); |
167 $("#notes").jqxInput({ theme: theme, width: 800, height: 100 }); |
170 $("#notes").jqxInput({ theme: theme, width: 800, height: 100 }); |
168 $("#profile").jqxInput({ theme: theme, width: 800, height: 48 }); |
171 $("#profile").jqxInput({ theme: theme, width: 800, height: 48 }); |
169 $("#ingredients").jqxInput({ theme: theme, width: 800, height: 23 }); |
172 $("#ingredients").jqxInput({ theme: theme, width: 800, height: 23 }); |
170 $("#examples").jqxInput({ theme: theme, width: 800, height: 48 }); |
173 $("#examples").jqxInput({ theme: theme, width: 800, height: 48 }); |
171 |
174 |
172 var dataAdapter = new $.jqx.dataAdapter(source), |
|
173 editrow = -1; |
|
174 // initialize jqxGrid |
175 // initialize jqxGrid |
175 $("#jqxgrid").jqxGrid({ |
176 $("#jqxgrid").jqxGrid({ |
176 width: 1280, |
177 width: 1280, |
177 height: 630, |
178 height: 630, |
178 source: dataAdapter, |
179 source: dataAdapter, |
300 }); |
301 }); |
301 $("#Cancel").jqxButton({ template: "primary", width: '90px', theme: theme }); |
302 $("#Cancel").jqxButton({ template: "primary", width: '90px', theme: theme }); |
302 $("#Save").jqxButton({ template: "success", width: '90px', theme: theme }); |
303 $("#Save").jqxButton({ template: "success", width: '90px', theme: theme }); |
303 // update the edited row when the user clicks the 'Save' button. |
304 // update the edited row when the user clicks the 'Save' button. |
304 $("#Save").click(function () { |
305 $("#Save").click(function () { |
305 var rowID = -1; |
306 var row, rowID = -1; |
306 if (editrow >= 0) { |
307 if (editrow >= 0) { |
307 rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); |
308 rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); |
308 } |
309 } |
309 var row = { |
310 row = { |
310 record: rowID, |
311 record: rowID, |
311 name: $("#name").val(), |
312 name: $("#name").val(), |
312 category: $("#category").val(), |
313 category: $("#category").val(), |
313 category_number: parseFloat($("#category_number").jqxNumberInput('decimal')), |
314 category_number: parseFloat($("#category_number").jqxNumberInput('decimal')), |
314 style_letter: $("#style_letter").val(), |
315 style_letter: $("#style_letter").val(), |