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

  • SEARCH
  • Home
  • 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 9293117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T21:03:09+00:00 2026-06-18T21:03:09+00:00

I use knockoutjs to update my Html view when an Javascript (Signalr) function is

  • 0

I use knockoutjs to update my Html view when an Javascript (Signalr) function is fired. But the view does not update when producthub.client.showOnlineUser is called. When i apply the binding everytime the table has same content multiple times. How can i just update the view in knockoutjs?

Html:

<table id="usersTable">
    <thead>
        <tr>
            <th>Name</th>
            <th>Mail</th>
        </tr>
    </thead>
    <tbody data-bind="foreach: seats">
        <tr>
            <td data-bind="text: NameFirst"></td>
            <td data-bind="text: Mail"></td>
        </tr>
    </tbody>
</table>

Javascript:

$(document).ready(function () {
     var applied = false;
     var model;
     producthub.client.showOnlineUser = function (userOnlineOnUrl, msg1) {
        function ReservationsViewModel() {
            var self = this;
            self.seats = ko.observableArray(userOnlineOnUrl);
        }

        model  = new ReservationsViewModel();
        if (!applied) {
            ko.applyBindings(model);
            applied = true;
        }

    };
});

userOnlineOnUrl is an JSON-Array which changes it’s data on each function call. The view (table) is not updated with it’s data.

  • 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-06-18T21:03:10+00:00Added an answer on June 18, 2026 at 9:03 pm

    try not to call model every time just update it with function

      $(document).ready(function () {
              var applied = false;
              var model;
              function ReservationsViewModel() {
                        var self = this;
                        self.seats = ko.observableArray();
                    }
              model = new ReservationsViewModel();
              ko.applyBindings(model);
              applied = true;
    
              producthub.client.showOnlineUser = function (userOnlineOnUrl, msg1) {                   
                    model  = new ReservationsViewModel();
                    //remove the previous data in array
                    model.seats.removeAll();
                    //Add new data to array 
                    model.seats(userOnlineOnUrl);
    
                    $('#onlineUsers').append(msg1);
                };
            });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've noticed that Knockout doesn't seem to update my view model when I use
Trying to update knockoutjs generated list, when i use jquery autocomplete functionality and select
I have created a View Model object for use with KnockoutJS. It has a
I have a page that requires jQuery.tmpl, but I want to use native knockout
When I use '.pop' or '.remove', knockout automatically removes the elements corresponding in html
I'm not sure if I'm trying to do too much here, but here is
I'm trying to use KnockoutJS to build an interactive dashboard with data bindings on
I am trying to use KnockoutJS on Node.js. Found one implementation of the same
I want to use $index in KnockoutJS to show alphabets instead of numbers.e.g, A.
I am fairly new to knockoutJS and cannot figure out how to use the

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.