Updated 073 JCB Fields Type Extended (markdown)

Amigo 2019-10-31 11:26:23 +02:00
parent 1dd7fd3785
commit 76ec5bf5af

@ -51,22 +51,35 @@ Then the 'button' feature is one of the features that are quite exciting. Let me
[00:12:29](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m29s) [00:12:29](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m29s)
If we now go back to the code, we see a new set of a script called `getinput`. That's how the button gets added. It asks `getAttribute('button')`, it checks if `button` is `true`. If button is `true`, then it already have the parent `HTML` (the whole field is in this HTML). If you have a button and someone clicks on it, you might want them to [00:13:07](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m07s) be redirected back to this page where the field is, once they are done on the other page. This is what it does, it checks if there is a 'Referral'. We are building a return value as well.>>>>>>> If we now go back to the code, we see a new set of a script called `getinput`. That's how the button gets added. It asks `getAttribute('button')`, it checks if `button` is `true`. If button is `true`, then it already have the parent `HTML` (the whole field is in this HTML). If you have a button and someone clicks on it, you might want them to [00:13:07](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m07s) be redirected back to this page where the field is, once they are done on the other page. This is what it does, it checks if there is a 'Referral'. We are building a return value as well.
We come down here and we start to build the button. There is the button being built(See Video). [00:13:44](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m44s) That is to create. This is called preachers, and down here we have a view called 'Preacher' and 'Preachers'. That is the Single View, the Single View name of the place, the field is added. This is the 'Listview'. We are grabbing the field data from the Preacher View, and it's List name is 'Preachers'. It is the table where the data is being captured from. Not the table where you are going to show the field but the table where you are taking the information from.[00:14:55](https://www.youtube.com/watchv=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m55s) If you take it from multiple tables, then you must choose a dominant table. The one that you want to be always available. That's what this is as well as you can see. It is usually the case that preachers and preacher values are the same. I decided to give the option to change the table name.
We come down here and we start to build the button. There is the button being built(See Video). [00:13:44](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m44s) That is to create. This is called preachers, and down here we have a view called 'Preacher' and 'Preachers'. That is the Single View, the Single View name of the place, the field is added. This is the 'Listview'. We are grabbing the field data from the Preacher View, and it's List name is 'Preachers'. It is the table where the data is being captured from. Not the table where you are going to show the field but the table where you are taking the information from.[00:14:55](https://www.youtube.com/watchv=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m55s) If you take it from multiple tables, then you must choose a dominant table. The one that you want to be always available. That's what this is as well as this as you can see. It is usually the case that preachers and preacher values are the same. I decided to give the option to change the table name. We will get to these again. Just wanted to [00:15:28](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h15m28s) show you that if those two(preacher and preachers) line-up, the button name lines up with those two. It checks whether this current user has authority to edit buttons. We can go down and create and edit button. We can also write JavaScript to [00:16:01](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h16m01s) give that button behavior. When you click change the field, it checks: Is it that value? And then it updates. You can check if this is JavaScript. This one up here is used to generate the create button and it also validates whether this user has create options, [00:16:30](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h16m30s) and is the user in the admin area. Currently this feature is not available to the site area and it's because of many conventions in the site area, and so is custom. It will probably break this button. We will have to work at this but this is where we are at.
We will get to these again. Just wanted to [00:15:28](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h15m28s) show you that if those two(preacher and preachers) line-up, the button name lines up with those two. It checks whether this current user has authority to edit buttons. We can go down and create and edit button. We can also write JavaScript to [00:16:01](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h16m01s) give that button behavior. When you click change the field, it checks: Is that value? and then it updates. You can check out if this is JavaScript. This one up here is used to generate the create button and it also validates whether this user has create options, [00:16:30](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h16m30s) and is the user in the admin area. Currently this feature is not available to the site area and it's because of many conventions in the site area, so is custom. It'll probably break this button. We'll have to work at this but this is where we are at.
### Able To Target The Admin Area With This Kind Of Button ### Able To Target The Admin Area With This Kind Of Button
[00:16:50](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h16m50s) [00:16:50](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h16m50s)
We are able to target the admin area with this kind of button. If we have a button, we add the button declaration to the document. Then we add the buttons to the field with this input append. This class here, is a Joomla class. Which means we are falling back on their implementation on how to add a little tweak to the field. That is how the button gets added and how it works. You can go through this, I mean it is quite simple. It's very easy code. This implementation is to make sure that the button name follows the convention and naming convention. [00:17:46](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h17m46s) That's the HTML and JavaScript that sets up the button. The reason why you would sometimes see the edit button there and sometimes not, is about the relationship here. The buttonName must match one of these(preacher and preachers). If it doesn't, it won't add it. That is if you want to have a [00:18:18](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h18m18s) button that already knows where we are going. How can I know those values? At the moment the only values we have, are these values it's come up here. These values(see video). We don't have other values. This is the values we have, the view ID. That's what we have to work with. If there's no relationship then how can we set the edit button? The relationship must be set. This is the way we set a relationship. That's quite simple. You must make sure that the name of the [00:18:58](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h18m58s) button, this one won't work. Although we said the button to be true, it will check the name and see this doesn't match and it won't add a button. That's good because we don't want a button here. We want a button to show up in Sermon Preacher. When it loads this(preacher) button it will check the name, it'll say this one matches and it will add a button. That's the right behavior, that's what we want. If we compile it. [00:19:36](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h19m36s) Go to sermons, click Behold he prayeth. We'll see it has an edit option. If we select none it has a create option, select Leonard Ravenhill it has a edit option. That is how that relationship comes together. We go back to the field. [00:20:07](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h20m07s) We have the buttons set. That's really the whole discussion. If you don't want the button set, but you want the button on the page, set this to false or just leave it out. It will take the button away completely. We are able to target the admin area with this kind of button. If we have a button, we add the button declaration to the document. Then we add the buttons to the field with this input append. This class here, is a Joomla class. Which means we are falling back on their implementation on how to add a little tweak to the field. That is how the button gets added and how it works. You can go through this, I mean it is quite simple. It's very easy code. This implementation is to make sure that the button name follows the convention and naming convention.
???? ### HTML and JavaScript Sets Up the Button
This table value is a mandatory value. [00:20:40](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h20m40s) Because it gives us a dynamic value which we can use in In many places including here You see a list button gets added to a page as well if we If we look back here at this implementation we see that here is a list Again But this isn't even in the view This is in the list View So you can Have a filter Dynamically in place for this again in the batch as well if you if you select batch [00:21:16](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h21m16s) There is also one available to select so all of these fields Are still using the information that we give here [00:17:46](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h17m46s)
That's the HTML and JavaScript that sets up the button. The reason why you would sometimes see the edit button there and sometimes not, is about the relationship here. The `buttonName` must match one of these(`preacher` and `preachers`). If it doesn't, it won't add it. That is if you want to have a [00:18:18](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h18m18s) button that already knows where we are going. How can I know those values? At the moment the only values we have, are these values it's come up here. These values(see video). We don't have other values. This is the values we have, the view ID. That's what we have to work with. If there's no relationship then how can we set the edit button? The relationship must be set.
### Set a Relationship
[00:18:46](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h18m46s)
This is the way we set a relationship. It is quite simple. You must make sure that the name of the button, in this case this specific one will not work although we set the button to be 'true', it will check the name and see this does not match and it will not add a button. That's good because we do not want a button here. We want a button to show up in Sermon Preacher. When it loads this(preacher) button it will check the name, it will say this one matches and it will add a button. That's the right behavior, that's what we want. If we compile it. [00:19:36](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h19m36s) Go to sermons, click:'_ Behold he prayeth_'. We will see it has an Edit option. If we select none it has a create option, select:' _Leonard Ravenhill_', it has a Edit option. That is how that relationship comes together. We go back to the field. [00:20:07](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h20m07s) We have the buttons set. That's really the whole discussion. If you don't want the button set, but you want the button on the page, set this to false or just leave it out. It will take the button away completely.
### Table value is a Mandatory Value
[00:20:36](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h20m36s)
This table value is a mandatory value. Because it gives us a dynamic value which we can use in in many places including here. A 'List' button gets added to a page as well. If we look back here at this implementation, here is a 'List' again but this isn't even in the view. This is in the List View. So you can have a filter dynamically in place for this again in the batch as well if you select batch. [00:21:16](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h21m16s) There is also one available to select so all of these fields are still using the information that we give here.>>>>
So if you don't have this information then some of these Fields functions will just Disappear It will Most probably not break But it will not be there so if you to see the fields filtering option is not working then it's because of these settings that are not right So if you don't have this information then some of these Fields functions will just Disappear It will Most probably not break But it will not be there so if you to see the fields filtering option is not working then it's because of these settings that are not right