Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6807833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:52:50+00:00 2026-05-26T19:52:50+00:00

From what I have done in past(before using knockoutjs) I would call the tabs()

  • 0

From what I have done in past(before using knockoutjs) I would call the tabs() function anytime I updated the view on a page. I’m trying to do this on a knockoutjs page I have done. Everytime I change the observable array it de-initializes the jquery tabs. That’s fine I’ll just call the function. This doesn’t seem to do anything.

    var viewModel = {       

    lines: ko.observableArray([]),      
    activeTab: ko.observable(),         
    addLine : function() {  

        var self = this;            
        $.post('/add/line', {customer_id : customer_id } , function(data) {                 
            var line = ko.toJS(data);               
            self.lines.push(new Line(line.id, line.name, line.equipType, line.model, line.height, line.length, line.loadsWeek, line.weight, line.width, line.pallets));

            $("#lineTabs").tabs({ selected: 0 });
            $(".palletTabs").tabs({ selected: 0 });             
        });     
    }
};

For some reason it works fine when I’m initializing the page.

$.getJSON("/json/all/lines", { customer_id : customer_id } , function(data) {       

        var mappedData = ko.utils.arrayMap(data, function(line) {               
            return new Line(line.id, line.name, line.equipType, line.model, line.height, line.length, line.loadsWeek, line.weight, line.width, line.pallets)        
        });

        viewModel.lines(mappedData);        

        $("#lineTabs").tabs({ selected: lineTabIndex });
        $(".palletTabs").tabs({ selected: 0 });

    }); 

Is there something I’m missing here? Thanks for any help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T19:52:51+00:00Added an answer on May 26, 2026 at 7:52 pm

    The roadmap for jQuery UI tabs shows that they are going to add a refresh method that would make this easier.

    When I have combined KO with jQuery UI tabs, I have relied on destroying and reinitializing the tabs whenever my observableArray changes.

    I use a custom binding to do this like:

    ko.bindingHandlers.jqTabs = {
        update: function(element, valueAccessor, allBindingsAccessor) {
           var dependency = ko.utils.unwrapObservable(valueAccessor()),
               currentIndex = $(element).tabs("option", "selected") || 0,
               config = ko.utils.unwrapObservable(allBindingsAccessor().jqTabOptions) || {};
    
            //make sure that elements are set from template before calling tabs API
            setTimeout(function() { 
                $(element).tabs("destroy").tabs(config).tabs("option", "selected", currentIndex);
           }, 0);
        }
    };
    

    When you use the binding, you would pass your observableArray to it. Optionally, you can pass config options for the tabs in the jqTabOptions additional binding. The binding does try to reset the selected index back to where it started when recreating it. Based on your code, you might not want to do this part.

    Here is a sample:
    http://jsfiddle.net/rniemeyer/rcqT4/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have done a lot of rails and ruby work in the past (using
From the reading that I have done, Core Audio relies heavily on callbacks (and
I'm trying to start unit testing on my application (should have done so from
In the past I've done web application development using Visual Studio. Initially I'd use
I have done some simple servlets in the past but no SOAP WS clients.
I have from the backend a time on the format 00:12:54 and I display
I have a asp.net web content from that have a asp.net textbox and I
do routed events from wpf have something in common with the chain of responsibility
Here's the code I have: from cStringIO import StringIO from lxml import etree xml
Continuing my problem from yesterday, the Silverlight datagrid I have from this issue is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.