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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T14:31:42+00:00 2026-06-18T14:31:42+00:00

Im using knockoutjs and try to setup a project including ko.mapping and a custom

  • 0

Im using knockoutjs and try to setup a project including ko.mapping and a custom update binding for an observableArray. When setting value directly, the update binding fires once, when using ko.mapping.fromJS, the update binding fires twice. See Fiddle or code below:

<!DOCTYPE html>
<html>
<head>
    <script type="text/javascript" src="knockout-2.2.1.js"> </script>
    <script type="text/javascript" src="knockout.mapping.js"></script>
</head>
<body>
    <div data-bind="foreach: ObservableArray, updateBinding: ObservableArray">
        <span data-bind="text: Value"></span>
    </div>
    <script type="text/javascript">
        ko.bindingHandlers['updateBinding'] = {
            init: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
                console.log("Binding Handler (Init)");
            },
            update: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
                console.log("Binding Handler (Update)");
                var data = ko.utils.unwrapObservable(valueAccessor());
            }
        };

        function MainViewModel() {
            var self = this;

            self.ObservableArray = ko.observableArray();
        }

        var viewModel = new MainViewModel();

        // Fires Init + Update for ObservableArray
        ko.applyBindings(viewModel);

        // Setting directly fires Update for ObservableArray once
        viewModel.ObservableArray([{ "Value": "Lucky Luke" }]);

        // Setting via mapping fires Update for ObservableArray twice
        ko.mapping.fromJS({ "ObservableArray": [{ "Value": "Ludwig van Beethoven" }] }, {}, viewModel);
    </script>
</body>
</html>
  • 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-18T14:31:43+00:00Added an answer on June 18, 2026 at 2:31 pm

    This was a bug by knockout.mapping when embedding arrays in regular objects and is now fixed (see github).

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

Sidebar

Related Questions

Using knockoutjs mapping plugin is it possible to only make the child elements observables?
I'm building a UI using KnockoutJs and Twitter Bootstrap. I'm using the checked binding
I've written a few custom bindings using KnockoutJS. I'm still unsure when to use
I've been building out a page using ASP.NET MVC 2 using KnockoutJS, KnockoutJS Mapping
I am using asp.net mvc 3 and knockoutjs 2.0 and mapping plugin I have
I'm using knockoutjs and the mapping plugin to generate view models from JSON returned
I'm using KnockoutJS... I have an observableArray of movies in my viewModel. The array
I am using knockoutjs with the jquery drag & drop and it works well
I'm using KnockoutJS with ASP.NET MVC, and I'm having a problem with broken bindings
I am using KnockoutJS and I would like to know of a way where

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.