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

OnSelect event does not fire as ...expected

1 Answer 121 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
nachid
Top achievements
Rank 1
nachid asked on 01 Sep 2010, 01:39 PM
I have an event handler I attached to my tabStrip like this
.ClientEvents(events => events.OnSelect( () => { %>
                                  function(e)
                                  {
                                      var item = $(e.item);
                                      if( item.index() === 2 )
                                      {           
                                         doSomeThing();
                                      }
                                   }
                               <% }
                              ))
This working fine when I click on my third tab  and select it
However, It happens also that I select and open my tab using code where I have a button when cliked open the tab

$('#btnNext').click(function ()
{
    var item = $('li.t-state-active +li');
    var tabstrip = $('.t-widget.t-tabstrip.t-header').data('tTabStrip');
    tabstrip.enable(item);
    tabstrip.select(item);
    return false;
});

the tab is opened but the attached event is not fired

1 Answer, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 01 Sep 2010, 01:52 PM
Hi nachid,

This is by design. Client-side methods do not trigger events. This was done to avoid endless recursion if the user calls the select method during the onselect event. I suggest you extract the onselect code in a JavaScript function and call that function when needed.

All the best,
Atanas Korchev
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
Tags
TabStrip
Asked by
nachid
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or