Updated 073 JCB Fields Type Extended (markdown)

Amigo 2019-11-01 16:33:10 +02:00
parent 5a1a130ca0
commit 6b33d52179
1 changed files with 5 additions and 1 deletions

@ -99,7 +99,11 @@ Next we have the components name. The reason why these can not be dynamic is bec
[00:25:54](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h25m54s)
Then we have a value_field and key_field. I should have maybe given this different names. Because the key_field is the ID field. Down here that placeholder is the same as the key-field. I'm saying it over there: The field value is the ###TEXT### value over there. [00:26:25](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h26m25s) The ###CODE_TEXT### is this ###TEXT### value again. But it didn't gets placed over in the ###CODE_TEXT###. The ###TEXT### and ###CODE_TEXT### value are the same value. ###CODE_TEXT### is the one that gets taken to the code. Well it's what becomes available in the item. You could change the ###CODE_TEXT### to whatever you like. These placeholders are there to make your life easier. If it doesn't help then replace them with static values. [00:27:00](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h27m00s) But the advantage of them being like this is you can come up here and decide, I no longer want to store the ID, because key_field is the value that get stored. It is the value that is over on this side. The Jhtml method setting up an option, takes the second value which is this one, has the value that get stored in the database. The third value as the value that gets shown in the drop down list. These are the two values that you're working with. You can add any PHP you like. I mean you could grab from any other table. You can do a very complicated query and generate a whole different list. [00:27:44](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h27m44s) Make sure that the IDs are not going to clash. If you expect the ID is clashing, you will need to add ID underscore something for one places information, ID underscore something else for another places information. You could do that because this selection concept **We'll keep on using this pattern all across JCB**. This is where you set the relationship [00:28:15](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h28m15s) inheritance structure everything. This is an area and it affects everything across JCB, wherever this field is going to be used. This is going to be available. It means that you have a lot of freedom in this little block because that is what it is going to be at the end of day, end up being placed here. You can get from other tables, you can do other interesting relationships here. [00:28:49](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h28m49s) It is important that at least the main table is the one that you mentioned here, the main component is the one you mentioned here. That tables view and list view names are used here. In this table, this one here, you are grabbing two values, you're grabbing a value to show to the user [00:29:19](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m19s) and a value to save in the database. That's the key value, the key_field that is the value get stored in the database. IF you're using this implementation. If you're not then you can just leave it out if you're not going to use this. You can hardcode whatever values you want down here. It'll still work in fact I would encourage you to test it. I have built custom Fields which I left out All of this information, [00:29:59](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m59s) and only did everything in here, it still worked. Because I was having such a dynamic value retrieval based on so many other concepts of the current view, I even grab the ID from the input to determine the Get relationship. There are very nice options.
Then we have a value_field and key_field. I should have maybe given this different names. Because the key_field is the ID field. Down here that placeholder is the same as the key-field. I'm saying it over there: The field value is the ###TEXT### value over there. [00:26:25](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h26m25s) The ###CODE_TEXT### is this ###TEXT### value again. But it didn't gets placed over in the ###CODE_TEXT###. The ###TEXT### and ###CODE_TEXT### value are the same value. ###CODE_TEXT### is the one that gets taken to the code. Well it's what becomes available in the item. You could change the ###CODE_TEXT### to whatever you like. These placeholders are there to make your life easier. If it doesn't help then replace them with static values. [00:27:00](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h27m00s)
But the advantage of them being like this is you can come up here and decide, I no longer want to store the ID, because key_field is the value that get stored. It is the value that is over on this side. The Jhtml method setting up an option, takes the second value which is this one, has the value that get stored in the database. The third value as the value that gets shown in the drop down list. These are the two values that you're working with. You can add any PHP you like. I mean you could grab from any other table. You can do a very complicated query and generate a whole different list. [00:27:44](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h27m44s) Make sure that the IDs are not going to clash. If you expect the ID is clashing, you will need to add ID underscore something for one places information, ID underscore something else for another places information. You could do that because this selection concept **We'll keep on using this pattern all across JCB**. This is where you set the relationship [00:28:15](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h28m15s) inheritance structure everything. This is an area and it affects everything across JCB, wherever this field is going to be used. This is going to be available. It means that you have a lot of freedom in this little block because that is what it is going to be at the end of day, end up being placed here. You can get from other tables, you can do other interesting relationships here. [00:28:49](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h28m49s)
It is important that at least the main table is the one that you mentioned here, the main component is the one you mentioned here. That tables view and list view names are used here. In this table, this one here, you are grabbing two values, you're grabbing a value to show to the user [00:29:19](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m19s) and a value to save in the database. That's the key value, the key_field that is the value get stored in the database. IF you're using this implementation. If you're not then you can just leave it out if you're not going to use this. You can hardcode whatever values you want down here. It'll still work in fact I would encourage you to test it. I have built custom Fields which I left out All of this information, [00:29:59](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m59s) and only did everything in here, it still worked. Because I was having such a dynamic value retrieval based on so many other concepts of the current view, I even grab the ID from the input to determine the Get relationship. There are very nice options.
### Very Nice Options