All,
Latest release of appgini!
Here's an example row from my application - a record from my Persons table;
https://ada.abernyte.org/ContentItem_Pe ... ectedID=45
If you scroll to the bottom, you can see the Child/Parent relationships of this table - this guy has associated records in a number of other tables in my system. This is all good.
I'm wondering, however, is there a way to hide the tabs where he doesn't have associated records? For example, He doesn't have any associated "Person Images" or "Census" records, yet they're still shown (albeit with a "No Matches Found" message) - could code modifications be made to hide these buttons/tabs altogether (until an associated record is added, then they'd appear)?
Any ideas?
Thanks!
Parent-Child Records - Hide tabs without Associated Records
-
- Veteran Member
- Posts: 67
- Joined: 2015-06-06 12:10
Re: Parent-Child Records - Hide tabs without Associated Records
If you don't want to do Ajax querys to know the number of rows, you can always count table rows (taking in consideration header and footer), on your Jquery ready to do something like this.
Code: Select all
$j(function(){ // jquery ready
if ($j('#panel_Person_Images-person_id tr').length<=2) { // If returned tr is 2 or less, then there aren't records.
$j('#panel_Person_Images-person_id').remove(); // Remove panel
$j('#tab_Person_Images-person_id').parent().remove(); // Remove tab
}
}); // end jquery ready
/Giuseppe
Professional Outsourcing Services
Professional Outsourcing Services
-
- Veteran Member
- Posts: 67
- Joined: 2015-06-06 12:10
Re: Parent-Child Records - Hide tabs without Associated Records
Thanks for the reply - interesting code. In which file should this be, though? Template?
Thanks!
Thanks!
Re: Parent-Child Records - Hide tabs without Associated Records
I never touch templates or files generated by appgini. This way I don't have to take care about my files being overwrited by AppGini.
You can do this echoing from PHP (_dv hook) or more elegant and structured, on a magic file. For example, for your table, the magic file should be
hooks/ContentItem_Persons-dv.js
You can do this echoing from PHP (_dv hook) or more elegant and structured, on a magic file. For example, for your table, the magic file should be
hooks/ContentItem_Persons-dv.js
/Giuseppe
Professional Outsourcing Services
Professional Outsourcing Services
-
- Veteran Member
- Posts: 67
- Joined: 2015-06-06 12:10
Re: Parent-Child Records - Hide tabs without Associated Records
Thanks Giuseppe! I will have to play with it and see what I can do. Thanks for help.