I have a question much like the "add a next button to a form"
I can specify a URL that directs to a detail-view.
Could be something like this : http://eksempelsite.dk/engdr/eng_firms_ ... ectedID=26
This detail view has two tabs.
The tab "Home" is the default.
If you hover the home, or ( mouse right click - copy link address ) you will see :
http://eksempelsite.dk/engdr/eng_firms_ ... tomer-info
If you hover the other tab ( additional info ) you will see : http://eksempelsite.dk/engdr/eng_firms_ ... dress-info
There could have been more tabs in a detail view.
How do you specify a/the URL that directs to the detail view, but also to a specific tab????
And should there be done something in a hook.
How to specify URL to a tab
Re: How to specify URL to a tab
Hi,
I'll try to give it a shot.
I think, as the page is recreated with tabs after the initial call, you will not be able to get directly to a tab, but if you use the information in the URL and use javascript, you should be able to extract the "#...." information which indicates to which tab you want to navigate and then you should be able to activate this tab.
You can activate your tab viawhere TABINFO is your "#...." like the #address-info.
Hope it helps
I'll try to give it a shot.
I think, as the page is recreated with tabs after the initial call, you will not be able to get directly to a tab, but if you use the information in the URL and use javascript, you should be able to extract the "#...." information which indicates to which tab you want to navigate and then you should be able to activate this tab.
You can activate your tab via
Code: Select all
$j('.nav-tabs a[href="'+TABINFO+'"]').tab('show');
Hope it helps
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: How to specify URL to a tab
Hello pböttcher
Thank you for responding.
I guess the URL should still be the one shown - but - how/where to use the code you have given?
Thank you for responding.
I guess the URL should still be the one shown - but - how/where to use the code you have given?
Re: How to specify URL to a tab
put it in the hooks/eng_firms-dv.js file (if it exisits, or create it). You may need to test if the tabs are already loaded, not sure right now in which order that happens, can't test it now.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: How to specify URL to a tab
Hello pböttcher
Thanks for quick response.
I created and uploaded eng_firms-dv.js
The content I have tried with is this :
$j('.nav-tabs a[href="'+TABINFO+'"]').tab('show');
and this
$j(function(){
$j('.nav-tabs a[href="'+TABINFO+'"]').tab('show');
});
The URL I use is this : http://eksempelsite.dk/engdr/eng_firms_ ... dress-info
It seems to have no effect
Thanks for quick response.
I created and uploaded eng_firms-dv.js
The content I have tried with is this :
$j('.nav-tabs a[href="'+TABINFO+'"]').tab('show');
and this
$j(function(){
$j('.nav-tabs a[href="'+TABINFO+'"]').tab('show');
});
The URL I use is this : http://eksempelsite.dk/engdr/eng_firms_ ... dress-info
It seems to have no effect
Re: How to specify URL to a tab
Hi,
can you try $j('.nav-tabs a[href="#address-info"]').tab('show');
can you try $j('.nav-tabs a[href="#address-info"]').tab('show');
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: How to specify URL to a tab
Hi
I tried it - but still no effect
I tried it - but still no effect
Re: How to specify URL to a tab
Hello again.
made a mistake.
The last one functions
made a mistake.
The last one functions
Re: How to specify URL to a tab
But of course it now directs to that tab always. I guess you wanted to know about the syntax.
Re: How to specify URL to a tab
Hi, you will need to check the calling url, otherwise it will always redirect.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: How to specify URL to a tab
Hi. Okay. You mean that I have to check if the url contains #customer-info and then use/set $j('.nav-tabs a[href="#customer-info"]').tab('show');
and check if url contains #address-info" and then use/set $j('.nav-tabs a[href="#address-info"]').tab('show');
Right?
and check if url contains #address-info" and then use/set $j('.nav-tabs a[href="#address-info"]').tab('show');
Right?
Re: How to specify URL to a tab
In case I only have two tabs I need only check for the second tab - i guess.
And in case I have 3 tabs, I only have to check for the last 2 ?
Because the first tab is the default.
And in case I have 3 tabs, I only have to check for the last 2 ?
Because the first tab is the default.
Re: How to specify URL to a tab
In this specific case, I should only have to check for the #address-info" and then use/set $j('.nav-tabs a[href="#address-info"]').tab('show');
Is this correct - and how should the check look like?
Is this correct - and how should the check look like?
Re: How to specify URL to a tab
Hi,
basically correct, but I would do it rather generic.
Something like:
would check if the URL contains the # sign and show the according tab if it was specified in the URL. So this could be used for any amount of tabs.
basically correct, but I would do it rather generic.
Something like:
Code: Select all
var url_string = window.location.href;
var idx=url_string.indexOf("#");
if (idx > 0) {
$j('.nav-tabs a[href="'+url_string.substring(idx)+'"]').tab('show');
}
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: How to specify URL to a tab
Hello pböttcher
You really are a super hero !!!
This functions, it is generel, and it is in a hook. This can be used for all views and without changing the code. And there is no special in it - if the detail-view is shown by a link ( with the ID ) then it is the URL shown on tab mouseover. Perfect.
Thank you
You really are a super hero !!!
This functions, it is generel, and it is in a hook. This can be used for all views and without changing the code. And there is no special in it - if the detail-view is shown by a link ( with the ID ) then it is the URL shown on tab mouseover. Perfect.
Thank you