Questions tagged [knockout-3.0]

Knockout.js is an open source JavaScript library for dynamic HTML UIs using the Model-View-View Model (MVVM) pattern. Version 3.0 was released on October 25th, 2013.

Knockout.js is an implementation of the Model-View-View Model (MVVM) UI pattern. This tag is for questions specific to the 3.0 versions. Refer to the main tag for general information.

Version 3.0 Features

Among its more interesting new features:

  • Array change subscriptions – a super-fast way to find out how an observable array has changed (i.e., which items were just added/deleted/moved) without having to run any differencing algorithm. See the example later.
  • Binding to detached nodes so frameworks built on top of Knockout have an easier time organizing all the DOM fragments they work with in the background.
  • Clearer error reporting if binding hits a problem. After all, nobody enjoys debugging…
  • More helpful handling of arrays in which each entry is an observable (as distinct from observable arrays, which have of course always worked nicely).
  • Performance improvements
    • Computed properties no longer issue change notifications by default if their computed value is definitely unchanged since last time.
    • Reduced by almost half the number of hidden, internal observables that Knockout constructs to manage the state of your bindings.
    • Reduced the stack depth when processing chained observable notifications by four call frames per observable, permitting much longer chains.
  • Bug fixes including HTML-encoding dropdown-list captions, and reinstating the .toJSON function on the output from ko.toJS (which was inadvertently omitted in KO v3 beta).
  • New build system based on Grunt.js to make contributing to Knockout easier. At last all the custom Bash scripts are gone :)

More Details

For more information about the 3.0 release refer to:

407 questions
3
votes
2 answers

Knockout doesn't seem to like object.property in bind

In my Knockout.js templates, it would be convenient if I could access properties of an object on the view model: This doesn't work. The element is blank. However, I can do something like…
Brad
  • 159,648
  • 54
  • 349
  • 530
3
votes
2 answers

knockout.js 3.3 - rerendering component in foreach binding

My viewModel consist of observable array with observable elements. // viewmodel var viewModel = function () { this.o = ko.observableArray(); for (var i = 0; i < 3; i++) this.o.push(ko.observable(0)); }; I need to change the values of…
3
votes
1 answer

Knockout performance issues with arrays having dynamic columns

I'm using knockout.repeat to draw dynamic column array with following data: var columns = ko.observableArray([ new Column(1), new Column(2), new Column(3), new Column(4), new Column(5) }); var array =…
3
votes
2 answers

Knockout: dynamically add bindings to custom elements

In short: I'm looking for the component-equivalent of binding preprocessing. I am trying to encapsulate complex bindings such as
janfoeh
  • 10,243
  • 2
  • 31
  • 56
3
votes
2 answers

Access knockout binding from child element

Lets say i have this:
Is is possible for me to access the 'enable' binding of the parent container from within the custom binding? == Clarification: == In…
4imble
  • 13,979
  • 15
  • 70
  • 125
2
votes
1 answer

How to pass an item from knockout foreach to partial view as data-bind?

I have a table with the list myListB() of objects, which are displayed by knockout foreach making as many rows as myListB().Count.
David Shepard
  • 181
  • 2
  • 10
2
votes
1 answer

Force Knockout computed to re-evaluate after replacement of observable inside

A co-worker ran into the problem that a computed he wanted to test was not returning the expected output. This happens because we want to stub other computeds (which again are dependent on other computeds). After stubbing there are 0 observables…
Jonathan
  • 8,771
  • 4
  • 41
  • 78
2
votes
1 answer

Click event fires multiple times with enter key being held

There is the knockout-3.3.0 & jquery-1.11.2 & bootstrap-3 application. The template with click binding:
2
votes
2 answers

Oracle JET: Knockout not updating variable

I have the following oracle jet and knockout html file
2
votes
1 answer

Custom binding won`t update when the parsed number equals the current

The knockout binding won`t update the input when the entering a floatnumber that is parsed to a integer that is already entered/parsed. Changing the input to another number or clearing the input works. But I need it to work for all number. All help…
RoarG
  • 793
  • 1
  • 7
  • 20
2
votes
1 answer

ko.JSON with observableArray throws Uncaught DOMException

I'm trying to persist an observable array to localStorage. To do this I'm using ko.toJSON. var that = this; this.items = ko.observableArray(); this.items.subscribe(function(){ localStorage.setItem("items", ko.toJSON(that.items())); }); All that…
2
votes
1 answer

Sub-array within an observable array

I am trying to create a new account which contains an inner array but I get an error: Uncaught Error: The argument passed when initializing an observable array must be an array, or null, or undefined. Any ideas why this is not working?