Updated 034 How to add Custom Buttons in JCB to your component Admin Area (markdown)

Amigo 2019-07-19 16:13:12 +02:00
parent 34aacd3f44
commit 48ceceb3fa

@ -33,7 +33,7 @@ To demonstrate where the code ends up. Save this as a selection in a List view a
[00:07:05](https://www.youtube.com/watch?v=VyBxWpJWb40&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m05s)
Now let us go back to editing that functionality there, and show some more options('Look'). Go to custom buttons. Add another button. Target - call it 'single'. Name - call it 'Work'. The Controller method - 'getDone', and leave Type to 'Default' and then save. [00:07:50](https://www.youtube.com/watch?v=VyBxWpJWb40&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m50s) In the Controller method there is a function called 'getDone'. In the(PHP controller method) a public function is placed. This time we will get the model and do something in the model. You can also get the item values. When this button is clicked, the item opens and it automatically submit the form. It is possible to grab the item's values but the values may differ from those in the database. [00:08:36](https://www.youtube.com/watch?v=VyBxWpJWb40&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m36s) The values could be changed, by clicking that button, and it will submit these changed values. Yet those values have not been saved to the database. If those values need to be in the database, you have to put it there. I'm not going to demonstrate how to do that. The model has a save method, and you should do the necessary sanitation, and trigger the save method, and it should store the data. For this purpose the data need to be grabbed, a verification be done, and then return either an error or a success. <<<<<<<<<<<<<<<<<<<<<
Now let us go back to editing that functionality there, and show some more options('Look'). Go to Custom Buttons. Add another button.(See video) Target - call it 'single'. Name - call it 'Work'. The Controller method - 'getDone', and leave Type to 'Default' and then save. [00:07:50](https://www.youtube.com/watch?v=VyBxWpJWb40&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m50s) In the Controller method there is a function called 'getDone'. In the(PHP controller method) a public function is placed. This time we will get the model and do something in the model. You can also get the item values. When this button is clicked, the item opens and it automatically submit the form. It is possible to grab the item's values. The values may differ from those in the database. [00:08:36](https://www.youtube.com/watch?v=VyBxWpJWb40&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m36s) The values could be changed, by clicking that button, and it will submit these changed values. Yet those values has not been saved to the database. If those values need to be in the database, you have to put it there. The model has a save method, and you should do the necessary sanitation, and trigger the save method, and it should store the data. For this purpose the data need to be grabbed, a verification done, and then return either an 'error' or a 'success'. <<<<<<<<<<<<<<<<<<<<<