Page 1 of 1
Adding a custom Tab
Posted: 2019-11-14 20:42
by dharbitindy
Does anyone know how to add a custom Tab, or Button in the Detail View of a Child Table? Attached is a screen shot of what I'm trying to do.
Thanks in advance,
David
Re: Adding a custom Tab
Posted: 2019-11-17 14:09
by pbottcher
Hi,
is the "Materials" Table related to the Quoting table, or do you just want to have a link to the Materials tableview?
Re: Adding a custom Tab
Posted: 2019-11-20 13:46
by dharbitindy
Yes, the Quoting table has a Lookup field from the Materials table (Matl Type above). It would be cool though to also know how to just have a link if they aren't related, but most importantly here is to just add a tab/link next to the already there Efficiency, Eng Chg Req, and Results tabs.
Thank you,
David
Re: Adding a custom Tab
Posted: 2019-11-20 18:55
by pbottcher
Hi,
you can try
Code: Select all
$j('#Efficiency_link').after($j('#Efficiency_link').clone().prop('id', 'Materials_link' ).attr("href", "materials_view.php").html($j('#IEfficiency_link').children().clone()).append(' Materials'));
This shall add a button to the materials TV.
Please check all names as I'm not sure which ones you use and if you have uppper or lowercase.
Re: Adding a custom Tab
Posted: 2019-11-20 19:31
by dharbitindy
Thank you and I'll give it a shot this evening. Should this code go in the Hooks section?
David
Re: Adding a custom Tab
Posted: 2019-11-20 20:15
by pbottcher
you can add the code through the quoting-tv.js file in the hooks section.
Re: Adding a custom Tab
Posted: 2019-11-20 20:19
by dharbitindy
Thank you sir! I'll let you know how it goes.
David
Re: Adding a custom Tab
Posted: 2019-11-21 02:24
by dharbitindy
Hello Pascal,
I did try this and didn't have any luck. I am attaching 3 screen shots to see if that helps.
Thanks again,
David
Re: Adding a custom Tab
Posted: 2019-11-21 18:50
by pbottcher
Sorry my mistake,
can you put the script in quoting-dv.js
Re: Adding a custom Tab
Posted: 2019-11-21 20:33
by dharbitindy
Tried it in the quoting-dv.js and still didn't show up. Weird, seems like that would work?
Re: Adding a custom Tab
Posted: 2019-11-22 13:45
by pbottcher
Hi,
please try to wrap the code in
$j(function(){
<code>
}
Re: Adding a custom Tab
Posted: 2019-11-22 17:51
by dharbitindy
Oddly it is still not showing up...
$j(function(){
$j('#Efficiency_link').after($j('#Efficiency_link').clone().prop('id', 'Materials_link' ).attr("href", "materials_view.php").html($j('#IEfficiency_link').children().clone()).append(' Materials'));
} (Tried this with and without the Parenthesis and the above code is all one line)
$j(function(){
/* Set the following fields as read only to avoid user editing */
$j('#pph').prop('readonly', true);
$j('#sec_pph').prop('readonly', true);
})
Re: Adding a custom Tab
Posted: 2019-11-22 19:02
by pbottcher
Did you try
$j(function(){
$j('#Efficiency_link').after($j('#Efficiency_link').clone().prop('id', 'Materials_link' ).attr("href", "materials_view.php").html($j('#IEfficiency_link').children().clone()).append(' Materials'));
})
Re: Adding a custom Tab
Posted: 2019-11-22 19:13
by pbottcher
Otherwise try
$j(function(){
$j('[id$=_link]:last').after($j('[id$=_link]:first').clone().prop('id', 'Materials_link' ).attr("href", "materials_view.php").text('new').html($j('[id$=_link]:first').children().clone()).append(' Materials'))
})
Re: Adding a custom Tab
Posted: 2019-11-22 19:34
by dharbitindy
Tried both, but neither would show the new link for some reason.
Thank you,
David
Re: Adding a custom Tab
Posted: 2019-11-22 20:14
by pbottcher
Ok, clarified the issue with David. The table is called differently, so the correct code to work is
$j(function(){
$j('#eff_link').after($j('#eff_link').clone().prop('id', 'Materials_link' ).attr("href", "materials_view.php").html($j('#eff_link').children().clone()).append(' Materials'));
})
Re: Adding a custom Tab
Posted: 2019-11-24 00:15
by dharbitindy
As usual pböttcher is a genius! I had a table name that didn't match the name shown for cloning a link.
Thanks again!
David