42 } |
42 } |
43 |
43 |
44 |
44 |
45 $(document).ready(function () { |
45 $(document).ready(function () { |
46 |
46 |
47 var dataRecord = {}; |
47 var dataRecord = {}, |
48 var url = "includes/db_profile_styles.php"; |
48 url = 'includes/db_profile_styles.php', |
49 |
49 source = { |
50 // prepare the data |
|
51 var source = { |
|
52 datatype: "json", |
50 datatype: "json", |
53 cache: false, |
51 cache: false, |
54 datafields: [ |
52 datafields: [ |
55 { name: 'record', type: 'number' }, |
53 { name: 'record', type: 'number' }, |
56 { name: 'name', type: 'string' }, |
54 { name: 'name', type: 'string' }, |
168 $("#notes").jqxInput({ theme: theme, width: 800, height: 100 }); |
167 $("#notes").jqxInput({ theme: theme, width: 800, height: 100 }); |
169 $("#profile").jqxInput({ theme: theme, width: 800, height: 48 }); |
168 $("#profile").jqxInput({ theme: theme, width: 800, height: 48 }); |
170 $("#ingredients").jqxInput({ theme: theme, width: 800, height: 23 }); |
169 $("#ingredients").jqxInput({ theme: theme, width: 800, height: 23 }); |
171 $("#examples").jqxInput({ theme: theme, width: 800, height: 48 }); |
170 $("#examples").jqxInput({ theme: theme, width: 800, height: 48 }); |
172 |
171 |
173 var dataAdapter = new $.jqx.dataAdapter(source); |
172 var dataAdapter = new $.jqx.dataAdapter(source), |
174 var editrow = -1; |
173 editrow = -1; |
175 // initialize jqxGrid |
174 // initialize jqxGrid |
176 $("#jqxgrid").jqxGrid({ |
175 $("#jqxgrid").jqxGrid({ |
177 width: 1280, |
176 width: 1280, |
178 height: 630, |
177 height: 630, |
179 source: dataAdapter, |
178 source: dataAdapter, |
180 theme: theme, |
179 theme: theme, |
181 showstatusbar: true, |
180 showstatusbar: true, |
182 renderstatusbar: function (statusbar) { |
181 renderstatusbar: function (statusbar) { |
183 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
182 var container, addButton, impButton; |
184 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>"); |
183 container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
185 var impButton = $("<div style='float: right; margin-right: 50px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Import</span></div>"); |
184 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>"); |
|
185 impButton = $("<div style='float: right; margin-right: 50px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Import</span></div>"); |
186 container.append(addButton); |
186 container.append(addButton); |
187 container.append(impButton); |
187 container.append(impButton); |
188 statusbar.append(container); |
188 statusbar.append(container); |
189 addButton.jqxButton({ theme: theme, width: 90, height: 20 }); |
189 addButton.jqxButton({ theme: theme, width: 90, height: 20 }); |
190 impButton.jqxButton({ theme: theme, width: 90, height: 20 }); |
190 impButton.jqxButton({ theme: theme, width: 90, height: 20 }); |
214 $("#ingredients").val(''); |
214 $("#ingredients").val(''); |
215 $("#examples").val(''); |
215 $("#examples").val(''); |
216 $("#popupWindow").jqxWindow('open'); |
216 $("#popupWindow").jqxWindow('open'); |
217 }); |
217 }); |
218 impButton.click(function (event) { |
218 impButton.click(function (event) { |
219 var url="import_ingredients.php?select=styles"; |
219 window.location.href = 'import_ingredients.php?select=styles'; |
220 window.location.href = url; |
|
221 }); |
220 }); |
222 }, |
221 }, |
223 filterable: true, |
222 filterable: true, |
224 filtermode: 'excel', |
223 filtermode: 'excel', |
225 columns: [ |
224 columns: [ |
242 return "Wijzig"; |
241 return "Wijzig"; |
243 }, buttonclick: function (row) { |
242 }, buttonclick: function (row) { |
244 // open the popup window when the user clicks a button. |
243 // open the popup window when the user clicks a button. |
245 editrow = row; |
244 editrow = row; |
246 // get the clicked row's data and initialize the input fields. |
245 // get the clicked row's data and initialize the input fields. |
247 var dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow); |
246 dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow); |
248 $("#name").val(dataRecord.name); |
247 $("#name").val(dataRecord.name); |
249 $("#category").val(dataRecord.category); |
248 $("#category").val(dataRecord.category); |
250 $("#category_number").val(dataRecord.category_number); |
249 $("#category_number").val(dataRecord.category_number); |
251 $("#style_letter").val(dataRecord.style_letter); |
250 $("#style_letter").val(dataRecord.style_letter); |
252 $("#style_guide").val(dataRecord.style_guide); |
251 $("#style_guide").val(dataRecord.style_guide); |