Updated 013 dynamicGet (markdown)

Amigo 2019-06-14 09:20:35 +02:00
parent e2343f088c
commit 16e8e04579
1 changed files with 9 additions and 10 deletions

@ -18,22 +18,21 @@ These are the fields inside of the 'Preacher' view. Load it and place this as 'a
### Get Types - Get Item/List Get Custom
There are four getTypes: 'getitem' which will get one item from the 'preacher' table and 'getlistquery' which will get multiple items. [00:04:41](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m41s) (Depending on how many items you want to get from the database, select either 'getitem' or 'getlist'.) Then 'getcustom' and 'getcustoms', plural. The difference between these four is that you will only use the 'getitem' once per view. [00:05:04](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m04s)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
If you are building a custom admin view, you will select a main get either, or a getitem or a getlist. You can add multiple getcustom item or getcustoms item. You can see these as other methods that you're adding to the page, but it's not the main method. [00:05:30](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m30s) You have main methods which are these getitem and getlistquery. Which by the way is the exact naming of the methods that will be used. Then you have this getcustom and getcustoms, which is almost same as these two, it's just that they are not main. There will only be another method in the model which will bring data to the view. You can add as many getcustom and getcustoms [00:06:00](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m00s) methods to your view as you like, but you could only add one getitem, and one getlistquery. Usually the way we would decide on this is that we would say what is the main objective of the view? What is the main dataset that we want to use in the view? That is what we will use in the getlistquery and getitem.[00:06:27](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m27s)
There are four getTypes: 'getitem' which will get one item from the 'preacher' table and 'getlistquery' which will get multiple items. [00:04:41](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m41s) (Depending on how many items you want to get from the database, select either 'getitem' or 'getlist'.) Then 'getcustom' and 'getcustoms', plural. The difference between these four is that you will only use the 'getitem' once per view. [00:05:04](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m04s)
If you are building a custom admin view, you will select a main 'get', either of a 'getitem' or either of a 'getlist'. You can add multiple 'getcustom' item or 'getcustoms' items. This can be seen as other methods that can be added to the page, but it's not the main method. [00:05:30](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m30s) You have main methods which are these 'getitem' and 'getlistquery', which is the exact naming of the methods that will be used. Then you have this 'getcustom' and 'getcustoms', which is almost the same as these two, it is just that they are not 'main'. There will only be another method in the model which will bring data to the view. [00:06:00](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m00s) You can add as many 'getcustom' and 'getcustoms'methods to your view as you like, but you can only add one 'getitem', and one 'getlistquery'. To determine this is to ask what the main objective of the view is. What is the main dataset that need to be used in the view? That is what the 'getlistquery' and 'getitem' respectively are going to be used for.[00:06:27](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m27s)
### Get List Pagination
If the main purpose of the view show preachers, a list of preachers, I would use the getlistquery as the main selection here. Now you see that you have when you do a listquery, you have the option of adding pagination. That would mean whether the data should only return a certain number. Joomla has a global number. Which you set in the system administrative area under your global settings. [00:07:00](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m00s) Go to system, then global configuration, then you see there is a default list limit. That is what will be use as the amount that limits the data being returned to the page. It will only return at this stage 20 items. [00:07:26](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m26s) If I set that pagination to yes. If I set it to no, it will load all the data. Yes would just load some of it, and no will load all of the data. Depends on what you want to do. If you want to do an Ajax, you want to be sure that all the data is being loaded every time. You rather use JavaScript set up pagination for your view, then that is why you would use the no switch most of the time, just say yes. [00:08:00](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m00s) Component builder will automatically add the pagination code to the page. It will also automatically add pagination code to the model, at the bottom of the page, it will show a 1, 2, 3 pagination. Depending on the template you are using and the styles that are on the page. If bootstrap is not on the page, that 1, 2, 3 might possibly not look right and you will need to add styling to it. [00:08:31](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m31s) Component Builder doesn't know what style is on your page so they cannot make provision for all of that. But it actually can load the pagination itself. it
If the main purpose of the view is to show a list of preachers, then 'getlistquery' is used as the main selection. When a 'listquery' is done, there is the option of adding pagination. That is to decide whether the data should only return a certain number. Joomla has a global number which can be set in the system administrative area under 'Global' settings. [00:07:00](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m00s) Go to 'System', then to 'Global configuration', there is a 'Default list limit'. That is what will be used as the amount that limits the data being returned to the page. In this instance it will only return 20 items. [00:07:26](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m26s) If I set that pagination to 'yes'. If I set it to 'no', it will load all the data. 'Yes' would only load some of it, and 'no' will load all of the data, depending on what you want to do. Is it to do an Ajax, you want to be sure that all the data is being loaded every time or if you rather use JavaScript to set up pagination for your view, then that is why you would use the 'no' switch. Most of the time, just say, 'yes'. [00:08:00](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m00s) Component Builder will automatically add the pagination code to the page. It will also automatically add pagination code to the model, at the bottom of the page, it will show a 1, 2, 3 pagination. Depending on the template you are using and the styles that are on the page. If bootstrap is not on the page, that 1, 2, 3 might possibly not look right and you will need to add styling to it. [00:08:31](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m31s) Component Builder doesn't know what style is on your page so it cannot make provision for all of that. But it actually can load the pagination itself.
### Join Data Views - Tables
Now here you have data and you can join this data to other database tables. Again here like with the main source you're able to select [00:08:57](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m57s) joint views from a table. A view table which is the views of the component or just any database table. To one of the database tables I often connect to categories. Component builder integrates it's application. If you add a category field to any view, [00:09:22](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m22s) it dynamically set up a category for your component. And integrates the category concept into your component, so it writes all that code for you and the way that Joomla's own applications like article manager does it. It's using the same conventions. If you know how Joomla article manager is bringing categories into the articles, then that is the way your component is going to do it. Here(DB Table - cb_categories) you can select categories. [00:09:54](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m54s) These switches, I'll deal with them when we come and look in more detail at this area. Then you can model the data there(Selection). Model means decide what you want to return. You don't want to return everything from categories.
In this area(see video) is data and this data can be joined to other database tables. In this area(See video) like with the main source it is possible to select joint views from a table.[00:08:57](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m57s) A view table which is the views of the component or just any database table. To one of the database tables I often connect to categories. Component builder integrates it's application. If you add a category field to any view, [00:09:22](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m22s) it dynamically set up a category for your component. And integrates the category concept into your component, so it writes all that code for you and the way that Joomla's own applications like article manager does it. It's using the same conventions. If you know how Joomla article manager is bringing categories into the articles, then that is the way your component is going to do it. Here(DB Table - cb_categories) you can select categories. [00:09:54](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m54s) These switches, I'll deal with them when we come and look in more detail at this area. Then you can model the data there(Selection). With 'Model' is meant to decide what needs to be returned, as not everything needs to be returned from categories. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
### Join View Tables Example