32 isModal: true, |
32 isModal: true, |
33 modalOpacity: 0.4, |
33 modalOpacity: 0.4, |
34 okButton: $('#delOk'), |
34 okButton: $('#delOk'), |
35 cancelButton: $('#delCancel'), |
35 cancelButton: $('#delCancel'), |
36 initContent: function () { |
36 initContent: function () { |
37 $('#delOk').jqxButton({ width: '65px', theme: theme }); |
37 $('#delOk').jqxButton({ template: "danger", width: '65px', theme: theme }); |
38 $('#delCancel').jqxButton({ width: '65px', theme: theme }); |
38 $('#delCancel').jqxButton({ template: "success", width: '65px', theme: theme }); |
39 $('#delCancel').focus(); |
39 $('#delCancel').focus(); |
40 } |
40 } |
41 }); |
41 }); |
42 $('#eventWindow').jqxWindow('hide'); |
42 $('#eventWindow').jqxWindow('hide'); |
43 } |
43 } |
80 $.ajax({ |
80 $.ajax({ |
81 dataType: 'json', |
81 dataType: 'json', |
82 url: url, |
82 url: url, |
83 cache: false, |
83 cache: false, |
84 data: data, |
84 data: data, |
|
85 type: "POST", |
85 success: function (data, status, xhr) { |
86 success: function (data, status, xhr) { |
86 // delete command is executed. |
87 // delete command is executed. |
87 commit(true); |
88 commit(true); |
88 }, |
89 }, |
89 error: function (jqXHR, textStatus, errorThrown) { |
90 error: function (jqXHR, textStatus, errorThrown) { |
122 } |
125 } |
123 }); |
126 }); |
124 } |
127 } |
125 }; |
128 }; |
126 // initialize the input fields. |
129 // initialize the input fields. |
127 $("#name").jqxInput({ theme: theme, width: 250, height: 23 }); |
130 $("#name").jqxInput({ theme: theme, width: 640, height: 23 }); |
128 $("#address").jqxInput({ theme: theme, width: 250, height: 23 }); |
131 $("#address").jqxInput({ theme: theme, width: 350, height: 23 }); |
129 $("#zip").jqxInput({ theme: theme, width: 120, height: 23 }); |
132 $("#zip").jqxInput({ theme: theme, width: 120, height: 23 }); |
130 $("#city").jqxInput({ theme: theme, width: 250, height: 23 }); |
133 $("#city").jqxInput({ theme: theme, width: 350, height: 23 }); |
131 $("#country").jqxInput({ theme: theme, width: 250, height: 23 }); |
134 $("#country").jqxInput({ theme: theme, width: 250, height: 23 }); |
132 $("#website").jqxInput({ theme: theme, width: 250, height: 23 }); |
135 $("#website").jqxInput({ theme: theme, width: 640, height: 23 }); |
133 $("#email").jqxInput({ theme: theme, width: 250, height: 23 }); |
136 $("#email").jqxInput({ theme: theme, width: 640, height: 23 }); |
134 $("#phone").jqxInput({ theme: theme, width: 120, height: 23 }); |
137 $("#phone").jqxInput({ theme: theme, width: 175, height: 23 }); |
135 $("#notes").jqxInput({ theme: theme, width: 640, height: 48 }); |
138 $("#notes").jqxInput({ theme: theme, width: 640, height: 48 }); |
136 |
139 |
137 var dataAdapter = new $.jqx.dataAdapter(source); |
140 var dataAdapter = new $.jqx.dataAdapter(source); |
138 var editrow = -1; |
141 var editrow = -1; |
139 // initialize jqxGrid |
142 // initialize jqxGrid |
166 }); |
169 }); |
167 }, |
170 }, |
168 filterable: true, |
171 filterable: true, |
169 filtermode: 'excel', |
172 filtermode: 'excel', |
170 columns: [ |
173 columns: [ |
171 { text: 'Leverancier naam', datafield: 'name', width: 250 }, |
174 { text: 'Leverancier naam', datafield: 'name' }, |
172 { text: 'Adres', datafield: 'address', width: 300 }, |
175 { text: 'Adres', datafield: 'address', width: 300 }, |
173 { text: 'Plaats', datafield: 'city', width: 250 }, |
176 { text: 'Plaats', datafield: 'city', width: 250 }, |
174 { text: 'Land', datafield: 'country', width: 250 }, |
177 { text: 'Land', datafield: 'country', width: 200 }, |
175 { text: 'Telefoon', datafield: 'phone', width: 100 }, |
178 { text: 'Telefoon', datafield: 'phone', width: 175 }, |
176 { text: 'Wijzig', datafield: 'Edit', columntype: 'button', cellsrenderer: function () { |
179 { text: 'Wijzig', datafield: 'Edit', width: 120, align: 'center', columntype: 'button', cellsrenderer: function () { |
177 return "Wijzig"; |
180 return "Wijzig"; |
178 }, buttonclick: function (row) { |
181 }, buttonclick: function (row) { |
179 // open the popup window when the user clicks a button. |
182 // open the popup window when the user clicks a button. |
180 editrow = row; |
183 editrow = row; |
181 $("#popupWindow").jqxWindow({ position: { x: 230, y: 30 } }); |
184 $("#popupWindow").jqxWindow({ position: { x: 230, y: 30 } }); |
201 width: 860, resizable: false, theme: theme, isModal: true, autoOpen: false, cancelButton: $("#Cancel"), modalOpacity: 0.40 |
204 width: 860, resizable: false, theme: theme, isModal: true, autoOpen: false, cancelButton: $("#Cancel"), modalOpacity: 0.40 |
202 }); |
205 }); |
203 $("#popupWindow").on('open', function () { |
206 $("#popupWindow").on('open', function () { |
204 $("#name").jqxInput('selectAll'); |
207 $("#name").jqxInput('selectAll'); |
205 }); |
208 }); |
206 $("#Delete").jqxButton({ theme: theme }); |
209 $("#Delete").jqxButton({ template: "danger", width: '80px', theme: theme }); |
207 $("#Delete").click(function () { |
210 $("#Delete").click(function () { |
208 if (editrow >= 0) { |
211 if (editrow >= 0) { |
209 // Open a popup to confirm this action. |
212 // Open a popup to confirm this action. |
210 $('#eventWindow').jqxWindow('open'); |
213 $('#eventWindow').jqxWindow('open'); |
211 $("#delOk").click(function () { |
214 $("#delOk").click(function () { |
213 $("#jqxgrid").jqxGrid('deleterow', rowID); |
216 $("#jqxgrid").jqxGrid('deleterow', rowID); |
214 }); |
217 }); |
215 } |
218 } |
216 $("#popupWindow").jqxWindow('hide'); |
219 $("#popupWindow").jqxWindow('hide'); |
217 }); |
220 }); |
218 $("#Cancel").jqxButton({ theme: theme }); |
221 $("#Cancel").jqxButton({ template: "primary", width: '80px', theme: theme }); |
219 $("#Save").jqxButton({ theme: theme }); |
222 $("#Save").jqxButton({ template: "success", width: '80px', theme: theme }); |
220 // update the edited row when the user clicks the 'Save' button. |
223 // update the edited row when the user clicks the 'Save' button. |
221 $("#Save").click(function () { |
224 $("#Save").click(function () { |
222 if (editrow >= 0) { |
225 if (editrow >= 0) { |
223 var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); |
226 var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); |
224 var row = { |
227 var row = { |