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

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

3 Answers 866 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
york
Top achievements
Rank 1
york asked on 16 Jan 2016, 07:53 AM

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.

3 Answers, 1 is accepted

Sort by
0
Accepted
Venelin
Telerik team
answered on 18 Jan 2016, 07:43 AM
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
0
york
Top achievements
Rank 1
answered on 21 Jan 2016, 11:15 PM
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.
0
Venelin
Telerik team
answered on 22 Jan 2016, 08:32 AM
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
Tags
TabStrip
Asked by
york
Top achievements
Rank 1
Answers by
Venelin
Telerik team
york
Top achievements
Rank 1
Share this question
or