Updated 020 Adding Custom Admin Views to a Component (markdown)

Amigo 2019-06-21 12:26:04 +02:00
parent 154cb1a017
commit 637acec300
1 changed files with 9 additions and 4 deletions

@ -30,16 +30,21 @@ To give a example of what happened with the settings: Open the 'Cost-Benefit Pro
This 'Order Before', selections is only really necessary when a 'main menu' and 'sub-menu' are selected. Because then it may be decided before what item this menu should be creating.[00:03:55](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m55s) 'Dashboard(list of records)' has been selected and consequently it places that in combined results. The records need to be selected that you want to look at and then click on the 'Combined results'. It will grab those ids and since the data is modeled in the controller and the model, it gives back to the view these results through the custom implementation that has been done. [00:04:25](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m25s)
### How Buttons are Implemented - Important (quick refresher.)
### How Buttons are Implemented - Important
* Quick refresher
If you go to Component Builder, and Custom Admin views, and open 'Company Results'. You will see that in the Custom Buttons, PHP has been added. 'Button' was also added . A request has been made to Component Builder as to what kind of buttons is needed. A single item is targeted It shows 'editCompany' and 'gotoCompany', these buttons [00:04:55](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m55s) are related to the inside of the view. On exiting 'Editing the Custom Admin Views', it even shows in 'Combined results', that 'buttons' also has been added. But again those buttons 'Vcard', 'companies', 'gotocompanies', corresponds to the controller. Going to the view itself, [00:05:27](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m27s) it shows that, it not responding to this(see video) button but actually to the buttons inside called 'Companies' and 'Edit'. These are the buttons you were building in the custom view. Whereas the buttons we are looking at in here(see video), is related to opening the Custom View itself. That is just a quick refresher.
The same applies to the Combined Results. The Combined Results is the button that is set up here(See video) 'Custom Admin View'. [00:06:02](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m02s) Whereas once the other buttons is combined, and Combined Results is clicked, it shows that two buttons has been added, 'Dashboard' and 'Companies'. Those two buttons had been set up in the view itself. It is possible to know what area controls what set of buttons. This area controls the buttons before opening the view. Whereas in the view, the buttons you have set up there, is for when you have opened the view. That is setting up a Custom Admin View to your component. [00:06:38](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m38s)<<<<<<<<<<<<<<<<<<
### The Combined Result Button
The same applies to the Combined Results. The Combined Results is the button that is set up here(See video) 'Custom Admin View'. [00:06:02](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m02s) Whereas once the other buttons is combined, and Combined Results is clicked, it shows that two buttons has been added, 'Dashboard' and 'Companies'. Those two buttons had been set up in the view itself. It is possible to know what area controls what set of buttons. This area controls the buttons before opening the view. Whereas in the view, the buttons you have set up there, is for when you have opened the view. That is setting up a Custom Admin View to your component. [00:06:38](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m38s)
If you are uncertain you can undo everything and simply change it and compile a component, and go look in the code, and see what has been done and look in the Joomla interface, and see what is being displayed. Do some experimenting until you get that what you expected .<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Some of the switches obviously again, if anything is unclear or you not exactly sure, you can come and undo anything. So simply go change it to what you would think should work and compile a component, and go look in the code, and see what has been done and look in the Joomla if the face, and see what is being displayed. Play around with it until you get that what you expected .[00:07:10](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m10s) Just a quick heads up this 'order before' is only compulsory when actually selecting add to main menu or add sub menu. If you use those it means that if you go to your component, you have the icons area, and here in the top you have your [00:07:34](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m34s) main menu items. Once you've opened, then here on the right, you have submenu. This is main menu, this is dashboard list. Now dashboard list is that one which goes to the top of the components toolbar and then submenu is the one here on the side. [00:07:58](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m58s)
[00:07:10](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m10s) Just a quick heads up this 'order before' is only compulsory when actually selecting add to main menu or add sub menu. If you use those it means that if you go to your component, you have the icons area, and here in the top you have your [00:07:34](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m34s) main menu items. Once you've opened, then here on the right, you have submenu. This is main menu, this is dashboard list. Now dashboard list is that one which goes to the top of the components toolbar and then submenu is the one here on the side. [00:07:58](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m58s)
This custom admin view simply needs to be placed in the submenu and its lives on its own it's not related to any other dataset. Then you can use the submenu method. If you only want to featured in the main menu, these are all the features that you could set. Where as the dashboard list record feature helps you to link it to a specific set [00:08:25](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m25s) of data structures like this one does. You can select these ids, and when you click on this combined results, the ids of the selected items gets passed to the controller. If I go back quickly to show you that how we use it. Combined results, custom buttons. [00:08:54](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m54s) We're using the 'main get' called companies data (getlistquery). Let's go and look at that data query, I think that's where we will find the use or the implementation of those ids. We are basically reaching into the input object here. We getting cid, [00:09:35](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m35s) selected ids, and we saying tt can be CMD. Then we are exploding it, and we are making sure it is intervals, and we placing it in ids. This actually gets 'this' value from the post object, [00:09:59](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m59s) and places that into ids. Here we do some validation to ensure that the person who's trying to access the data has actualy the right to do it. Once we pass that, we basically use those ids to get the data.