How to check if tab content is loaded or not in kendo tabstrip

4 posts, 1 answers
  1. york
    york avatar
    160 posts
    Member since:
    Jul 2012

    Posted 16 Jan Link to this post

    Hi,

    I have a kendo tabstrip in which I want to know if its content is loaded or not in event Select. The tabstrip is defined as

            <% Html.Kendo().TabStrip()
                .Name("TabStrip")
                .Items(tabstrip =>
                {
                    tabstrip.Add()
                        .Text(OTP.Ring.Models.ViewModel.EvaluationsLocalization.EvaluationForm_Tab_Overall)
                        .Content(() =>
                        {
                            %>
                                <div style="height: 400px"></div>
                            <%  
                        });
                })
                .Items(tabstrip =>
                {
                    tabstrip.Add()
                        .Text(OTP.Ring.Models.ViewModel.EvaluationsLocalization.EvaluationForm_Tab_Coaching)
                        .Content(() =>
                        {
                        });
                })
     ...
                .Events(e => e.Select("onTabSelect")
                              .Activate("onTabLoad")
                              )
                .SelectedIndex(Model.SelectedTabIndex)
                .Render();            %>       

     

            function onTabSelect(e) {
                var content = $(e.contentElement);

                var index = $(e.item).index();            

    ...
            }

    I tried $(e.contentElement).html(), but it is undefined. I am not sure how to get the content. The intent is that if the selected tab is already loaded before, then it won't be loaded again. Thanks.

  2. Answer
    Venelin
    Admin
    Venelin avatar
    352 posts

    Posted 18 Jan Link to this post

    Hello,

    Use Activated event instead, because it fires after a tab is being visible and after the end of the animation (if any): http://docs.telerik.com/kendo-ui/api/javascript/ui/tabstrip#events-activate.

    Regards,
    Venelin
    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
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. york
    york avatar
    160 posts
    Member since:
    Jul 2012

    Posted 21 Jan in reply to Venelin Link to this post

    I use Activate event when tabstrip is created. What I really want is to check if the content is loaded or not when a tab is selected. If the tab is selected for the 1st time, its content needs be loaded. If the tab is selected for the 2nd, 3rd, ... time, its content needs  not be loaded.
  5. Venelin
    Admin
    Venelin avatar
    352 posts

    Posted 22 Jan Link to this post

    Hello,

    "The intent is that if the selected tab is already loaded before, then it won't be loaded again"
    In principle, with .Content(), the content of TabStrip is loaded once with the widget itself. You don't need to check anything, because no content reload occurs.

    Regards,
    Venelin
    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
Back to Top
UI for ASP.NET MVC is VS 2017 Ready