Hey everyone,
Has anyone found a way to wire a click event up to the tab image?
Thanks,
Pat
Cool, I didn't know you could embed html in the text property and have it render. I will stick with the marked answer but I could see this working as well.
Thanks for the post.
<igtab:Tab Key="" Text="Tab<img src='images/CloseTab.gif' alt='Close Tab' style='cursor: hand;' onclick='closeTab(0)'>"
Tag="0" Visible="False">
acutally If the number of tabs is static, then the other way is to embed the image in the tab as above code and write events on the image.
as you see in above code i have attched the closeTab(0); function for onclick of my image. where 0 passed to close tab is my tab number.
Fantastic! This is what I was looking for.
Thanks, Viktor!
Hi Pat,
If tabs contain images and you want to check if those images were clicked, then the easiest way is to check if source of event is IMG. Below is example:
function UltraWebTab1_Click(oWebTab, oTab, oEvent){ if(!oEvent.event) return; var src = oEvent.event.srcElement; if(!src) src = oEvent.event.target; if(!src) return; if(src.nodeName == 'IMG') alert('Mouse click on image of tab #' + oTab.getIndex());}
If anyone else out there is looking for a work around for this issue, this is the best I can do right now.
What I do is:
Trap the click event of the tabs on the client.
Check to see if the current tab clicked is the same as the current selected tab. If it is, I assume that they are clicking on the image in the selected tab.
function uwt_Main_Click(oWebTab, oTab, oEvent){
//Add code to handle your event here.
alert('in tab clicked event.');
var CurrentTab = oWebTab.getSelectedIndex();
alert('oWebTab Index ' + CurrentTab);
var newTabClicked = oTab.getIndex();
alert('oTab Index ' + newTabClicked);
if(CurrentTab == newTabClicked)
{
alert('the tab selected is the tab clicked');
}
If anyone has a better idea, please share it! I bet you could wire an event in the java script file controlling the tab control I just haven't looked into it.