This is a migrated thread and some comments may be shown as answers.

Am I on a tab? Is that tab active?

2 Answers 83 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Karl
Top achievements
Rank 1
Karl asked on 09 Sep 2015, 08:58 AM

Hi

OK, not really used Rad controls before but I have to fix a bug in some code that contains a RadTab.

I have a javascript function, which is called onblur for a control.

Now this control may or may not be on a RadTab, so it won't know the id of the the RadTab control.  How in my javascript function can I check that the control is on a RadTab and if that tab is active?

I am assuming I can check the parent oject type?  but what am I looking for?  Any help greatly appreciated.

2 Answers, 1 is accepted

Sort by
0
Karl
Top achievements
Rank 1
answered on 09 Sep 2015, 10:41 AM
I have noticed that the container div has a control attribute control="[object Object]", can I check the object type?  of the value of  control and if so, what object type am I looking for? 
0
Nencho
Telerik team
answered on 12 Sep 2015, 08:07 AM
Hello Karl,

The desired functionality could be implemented using jQuery. You can subscribe for the blur event of the control and get all its parents. Thus, you can check for each one of them, if their ID contains "PageView". f course, for that purpose you need to set similar IDs for the PageViews, associated with the RadTabs (e.g. "RadPageView_Home").

In addition, in order to get the active tab, you can use the Client API of the RadTabStrip and the get_selectedTab() method on the RadTabStrip object.

In the attachment you can fond a simple example, which demonstrates the above suggested approach

Regards,
Nencho
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
TabStrip
Asked by
Karl
Top achievements
Rank 1
Answers by
Karl
Top achievements
Rank 1
Nencho
Telerik team
Share this question
or