Page 1 of 1
Renaming Tab title from multiple same lookup source
Posted: 2013-12-25 14:07
by wplim
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
Re: Renaming Tab title from multiple same lookup source
Posted: 2013-12-25 15:27
by Bertv
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
Re: Renaming Tab title from multiple same lookup source
Posted: 2013-12-26 03:39
by wplim
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.
[Solved] Re: Renaming Tab title from multiple same lookup so
Posted: 2013-12-26 04:14
by wplim
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);
}
}
}
Re: Renaming Tab title from multiple same lookup source
Posted: 2014-04-29 13:31
by toconnell
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.