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

Amigo 2019-06-22 10:29:55 +02:00
parent 74cc14451d
commit 5e6fe0302b
1 changed files with 6 additions and 4 deletions

@ -40,13 +40,15 @@ If you go to Component Builder, and Custom Admin views, and open 'Company Result
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 .<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
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 .[00:07:10](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m10s)
NB. This 'order before' is only necessary when 'add' is selected to 'Main-menu' or to 'Sub-menu'. If that is used there will be a icon area displayed in the component(Cost Benefit Projection) and at the top will the menu items be shown.(Companies). Once it is opened the Sub-menu appears on the left.[00:07:34](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m34s) There is 'Main' menu and 'Dashboard (list of records)'. Now 'Dashboard (list of records)'need to be placed at the top of the components toolbar and then 'Submenu' at the left. [00:07:58](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m58s)
The Custom Admin View simply needs to be placed in the Sub-menu and is independent from any other dataset and then the Sub-menu method can be used. If you want a feature in the main menu, these are all the features that can be set. [00:08:25](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m25s) Whereas the 'Dashboard (list record)' feature helps to link it to a specific set of data structures. These IDs can be selected, and when you click on this combined results, the IDs of the selected items gets passed to the controller. For example: Look in 'Companies',in 'Components' ,in 'Component Builder' in 'Custom Admin Views' in 'Combined results' and then in '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).<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
[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.
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.
In the filter [00:10:20](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m20s) we use ids, and check whether all the ids are in a id and that in the code. Basically if you look at the code, it's on the models combine results. We see that it uses our checking method here. Later down here it checks the ids. [00:10:45](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m45s) Puts it in an array. check if it's in an array then implodes it. Checks whether it gets those ids. That's how we filtered the dataset with the results of the selection. That's just a little bit looking into the back end on how to make use of those [00:11:07](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m07s) features and you can see, it's some custom scripting we added to the dynamic get method. To take those ids and to use them in the way we intend. You can ignore them, but here is the way that I implemented it.