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:

409 questions
41
votes
2 answers

KnockoutJS: computed vs. pureComputed

What's the difference between computed and pureComputed in KnockoutJS? Can I use pureComputed instead of computed safely?
mehrandvd
  • 8,250
  • 10
  • 54
  • 102
7
votes
2 answers

Undo change on cancel button

I am trying to cancel the changes done during my page edit. But whenever I click on cancel, the updated changes are reflected. How to revert the changes on click of cancel button. Any help on this will be really helpful since I am new to…
user4324324
  • 523
  • 2
  • 7
  • 19
7
votes
2 answers

How might I cancel a change to an observable array w/ Knockout 3.0?

I have a change occurring to an array. I am using Sanderson's latest array subscription method to catch the add/delete change. In this subscription is where I intend to bundle and send my request over the wire. If the request fails for any reason I…
beauXjames
  • 7,565
  • 3
  • 42
  • 65
6
votes
1 answer

The rest of the owl: Knockout BindingHandlers with Typescript?

I am trying in earnest to follow the accepted answer for this. I'm using Knockout, Typescript, MVC, VS2017 and node modules for most of my packages. The problem I'm having is that the binding does not get called but don't have any build errors.…
6
votes
2 answers

Missing /dist folder in Bower installation of Knockout 3.4.0 from Visual Studio 2015

I'm currently using Visual Studio 2015 to work on a project which is using NPM/Bower to manage the Javascript package dependencies. One of the packages we are using and have installed through Bower is knockout-3.4.0. If I go to…
Gareth
  • 381
  • 4
  • 9
6
votes
1 answer

Forcing update of a throttled computed property

I have a form with a text input bound to computed property (containing a time). After a user enters a value, it is parsed into a integer value containing the total minutes. Since this is not a trivial function (there are many ways of formatting…
Willem
  • 4,403
  • 20
  • 40
6
votes
1 answer

Knockout binding value.update not being called with custom binding and defineProperty

I have a Knockout extension, knockout-secure-binding, and we have encountered an issue. In particular when using Object.defineProperty, as knockout-es5 does, the value binding's update function is not called when a change event is triggered on an…
Brian M. Hunt
  • 71,376
  • 65
  • 208
  • 328
6
votes
2 answers

Grid widget with proper knockout bindings

I've been looking for the last couple of days for a decent Grid widget with proper knockout bindings; decent grid meaning to have support for filtering, grouping, paging, sorting, aggregates, templates, remote source, etc. Doesn't matter the licence…
alexb
  • 959
  • 6
  • 11
5
votes
4 answers

knockout.js subscribe is not getting called on the first set

I have a simple model class with observables. I simply want to subscribe to its sets. Here is the code that I have: var dto = function (data) { var self = this; self.Value1 = ko.observable(data.Value1); self.Value1.subscribe(function(){ …
jmogera
  • 1,579
  • 3
  • 29
  • 63
4
votes
2 answers

How to comment out knockout code in HTML

Is there any to comment out a knock out code in HTML, since the ko code is already in default html comment block.
Edit mode
Can I comment the above…
Jerin Joseph
  • 497
  • 5
  • 16
4
votes
2 answers

knockout.js how to set selected option after confirm() cancelled within a ko.computed write

i have a selector element with options and default text: self._selected = ko.observable(); self.option = ko.computed({ read:function(){ return self._selected; }, write: function(data){ if(data){ …
GZH
  • 168
  • 1
  • 5
4
votes
4 answers

Passing existing model to knockout component binding?

I've just began to explore knockout components, because our codebase was way before the components were introduced. A few things I don't get at first read. How can one use an existing viewmodel at component binding? To what should I bind when…
Zoltán Tamási
  • 10,479
  • 3
  • 51
  • 73
4
votes
1 answer

Is numeric animation behaviour possible with knockout observable?

For example you have simple model like this: var ViewModel = function() { var timer, self = this; this.value = ko.observable(10); this.value2 = ko.observable(10); this.value.subscribe(function(newValue){ …
misterion
  • 5,683
  • 3
  • 32
  • 55
4
votes
1 answer

Require, Knockout and pager are Undefined TypeError

I have the following main: requirejs.config({ paths:{ 'text':'../vendor/js/text.min', 'jquery':"../vendor/js/jquery.min", 'boostrap':"../vendor/js/bootstrap.min", 'ko':"http://knockoutjs.com/downloads/knockout-3.4.0.debug", …
Dimitrios Desyllas
  • 6,470
  • 6
  • 43
  • 106
4
votes
2 answers

How to iterate an Knockout ObservableArray? (length 0)

I'm new to knockout.js (and this is also my first stackoverflow post) and I'm now facing the following problem. I'm not able to bind the data from web api to a ko.observablearray. Why is the length of this Announcements ko.observablearray always 0?…
1
2 3
27 28