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 7831359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T11:41:33+00:00 2026-06-02T11:41:33+00:00

Background: I’ve got a single-page knockout.js app using the mapping plugin. The data is

  • 0

Background: I’ve got a single-page knockout.js app using the mapping plugin. The data is updated via Websocket JSON from the server. I can see that the app is successfully receiving the data (printing data in console) and when there are object removals/additions, the ViewModel updates no problem.

Problem: When a property of an object is updated from the server, it does not change the ViewModel. Do I need to return the object property somehow with each update?

Here are the relevant snippets of code:

var userMapping = {
        "users": {
            key: function(data) { return ko.utils.unwrapObservable(data.id); },
            create: function(options) {
                // for sortable ui access
                return createUser(options.data);
            }
        }
    };
var jobMapping = {
        "jobs": {
            key: function(data) { return ko.utils.unwrapObservable(data.id); },
            create: function(options) {
                // for sortable ui access
                return createJob(options.data);
            },
            update: function(options) {
                return createJob(options.data);
            }
        }
    };
var createJob = function(job, user) {        
        // leaflet init
        createJobIcon(job);

        // general data mapping
        var result = ko.mapping.fromJS(job);
        return result;
    };
self.engineModel.update = function(data) {
       ko.mapping.fromJS(data, userMapping, self.engineModel);
    };

And in the ViewModel:

<li data-bind="visible: canceled()==false, attr: {class: 'job-li canceled-'+canceled()+' started-'+started()+' hold-'+hold() }">

Thanks for the insight!

  • 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-02T11:41:37+00:00Added an answer on June 2, 2026 at 11:41 am

    I’ve been able to fix the behaviour but I remain skeptical about the long-term impact from the decision.

    I removed this line:
    key: function(data) { return ko.utils.unwrapObservable(data.id); },

    Now everything updates as it should. If anyone has thoughts about further processing I’m all ears (for example, does this affect performance?)

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

Sidebar

Related Questions

Background: Our web app uses the jquery.constrain.js plugin to handle data entry in some
[background below] I've got my data modelled out in SQLObject in Python on the
Background: I am using Eclipse to develop an Android app. I have an xml
Background I first wanted to upload a file via json and get a response
Background I have a dimension table that has a single record for each day.
Background : With a Python Script, I scraping data (html) from a Website and
Background :- I am using Django 1.3. We are using South as the module
Background: I'm using geoserver and openlayers to develop a gis webapp. Now I find
Background This is only my second PyQt4 project. Developing a Windows app that has
Background I have a basic HTML page with an iframe that points to a

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.