Renaming Tab title from multiple same lookup source

The recommended method of customizing your AppGini-generated application is through hooks. But sometimes you might need to add functionality not accessible through hooks. You can discuss this here.
Post Reply
wplim
Veteran Member
Posts: 36
Joined: 2013-01-17 22:42

Renaming Tab title from multiple same lookup source

Post by wplim » 2013-12-25 14:07

I am creating a simple Bill of Material.

the BOM table has 2 fields, parent_pn and child_pn.
Both fields look up from item_pn field in Item table. This will generate 2 tabs with same name "BOM" since there's only one entry in the Parent/Children settings.

How can I rename the other tabs?

Thanks,
Weoi
Attachments
appgini_renaming tab title.png
appgini_renaming tab title.png (20.62 KiB) Viewed 6628 times

Bertv
Veteran Member
Posts: 65
Joined: 2013-12-11 15:59

Re: Renaming Tab title from multiple same lookup source

Post by Bertv » 2013-12-25 15:27

Hi,
look in templates/<tablename>DV.html
There is someting like
<div class="panel-body" id="<tablename>_dv_container">
<!-- child links -->
<div class="row">
<div class="col-xs-12">
<a class="hidden-xs btn btn-default btn-lg pull-right ......</i> tab-title-one </a>
<a class="visible-xs btn btn-default btn-lg btn-block ......</i> tab-title-one </a>
.....
<a class="hidden-xs btn btn-default btn-lg pull-right ......</i> tab-title-two </a>
<a class="visible-xs btn btn-default btn-lg btn-block ......</i> tab-title-two </a>


In your situation tab-title-one and tab-title-two are the same. Change onw of then.

Bert
Bert
I am using Appgini 5.75

wplim
Veteran Member
Posts: 36
Joined: 2013-01-17 22:42

Re: Renaming Tab title from multiple same lookup source

Post by wplim » 2013-12-26 03:39

Unfortunately, it does not show the repetition.
It only shows the "bom" table tab title once, then skip to another table tab title (third tab).

I believe the actual Tab Title specified in Appgini is stored in another file.

wplim
Veteran Member
Posts: 36
Joined: 2013-01-17 22:42

[Solved] Re: Renaming Tab title from multiple same lookup so

Post by wplim » 2013-12-26 04:14

Here's how I solve it:

File edited: parent-children.php

Add a condition to filter the ChildLookupField and apply a custom title to it. In my case, the ChildLookupField is "parentid".

/* process requested operation */
switch($Operation){
/************************************************/
case 'show-children':
/* populate HTML and JS content with children tabs */
$tabLabels = $tabPanels = $tabLoaders = '';
foreach($userPCConfig as $ChildTable => $childLookups){
foreach($childLookups as $ChildLookupField => $childConfig){
if($childConfig['parent-table'] == $ParentTable){
$TableIcon = ($childConfig['table-icon'] ? "<img src=\"{$childConfig['table-icon']}\" border=\"0\" />" : '');
if($ChildLookupField != "parentid"){
$tabLabels .= sprintf('<li%s><a href="#panel_%s-%s" id="tab_%s-%s" data-toggle="tab">%s%s</a></li>' . "\n\t\t\t\t\t",($tabLabels ? '' : ' class="active"'), $ChildTable, $ChildLookupField, $ChildTable, $ChildLookupField, $TableIcon, $childConfig['tab-label']);
}else{
$tabLabels .= sprintf('<li%s><a href="#panel_%s-%s" id="tab_%s-%s" data-toggle="tab">%sBOM Item</a></li>' . "\n\t\t\t\t\t",($tabLabels ? '' : ' class="active"'), $ChildTable, $ChildLookupField, $ChildTable, $ChildLookupField, $TableIcon);
}

$tabPanels .= sprintf('<div id="panel_%s-%s" class="tab-pane%s"><img src="loading.gif" align="top" />%s</div>' . "\n\t\t\t\t", $ChildTable, $ChildLookupField, ($tabPanels ? '' : ' active'), $Translation['Loading ...']);
$tabLoaders .= sprintf('post("parent-children.php", { ChildTable: "%s", ChildLookupField: "%s", SelectedID: "%s", Page: 1, SortBy: "", SortDirection: "", Operation: "get-records" }, "panel_%s-%s");' . "\n\t\t\t\t", $ChildTable, $ChildLookupField, addslashes($SelectedID), $ChildTable, $ChildLookupField);
}
}
}

User avatar
toconnell
Veteran Member
Posts: 204
Joined: 2013-04-09 19:29
Location: Oklahoma City, OK
Contact:

Re: Renaming Tab title from multiple same lookup source

Post by toconnell » 2014-04-29 13:31

I tried to do this but it seems it is a bit different in the newest versions..
Ahmad, how is it best to correct this now?

I know in the app gini table you can name a child there... should that be where it is done?

If so, how to name them differently? I have a table with 9 foreign lookup fields and it is very confusing for users.. would be nice to fix that.
Tina O'Connell
Web Dev & Appgini FAN

Post Reply