Questions tagged [knockout-3.2]

Knockout.js is an open source JavaScript library for dynamic HTML UIs using the Model-View-View Model (MVVM) pattern. Version 3.2 adds "components" to bring a new and hugely more scalable way of structuring a large application.

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

Version 3.2.0 brings (amongst others):

  • Components and Custom Elements;
  • ko.pureComputed observables;
  • A textInput binding to replace value bindings with valueUpdate options.
  • Several fixes and minor updates.
29 questions
1
vote
2 answers

When to create new view models in Knockout.js

I've seen there's generally a bit of confusion when talking about multiple view models in knockout.js The ko documentation doesn't really explain very much how to deal with multiple view models, how to communicate between them or when should they be…
Alvaro
  • 40,778
  • 30
  • 164
  • 336
0
votes
1 answer

Replace template element for normal div in knockout.js

I'm trying to use templates without using the template tag as this one is not supported in any version of IE. Instead of this: I'm trying to use:
Alvaro
  • 40,778
  • 30
  • 164
  • 336
0
votes
2 answers

Bind text to a global function

Trying to bind text to a global function outside the viewmodel throws the following error: knockout.js:60 Uncaught ReferenceError: Unable to process binding "foreach: function (){return names }" Message: Unable to process binding "text: function…
Alvaro
  • 40,778
  • 30
  • 164
  • 336
0
votes
1 answer

On click a DIV apply dynamic data binding to edit the CSS using an HTML input - knockout.js

I'm trying to edit individual elements of an array. I have a JSON array like this: [ {"idComponent":1,"left":"100px","top":"100px","idHTML":"name_div","width":"200px","height":"300px","value":"My name is"} …
Sergio
  • 441
  • 9
  • 22
0
votes
1 answer

Nesting components in knockoutjs

I have a knockout component that I'm using to encapsulate a bootstrap modal. It works great except for when I try to insert any content into the body of the modal. My first approach was putting html into the params.Content of the modal-dialog but I…
adc90
  • 303
  • 3
  • 10
0
votes
1 answer

Knockout Binding Select Change with MVC 5

I'm using Knockout's "foreach" function on my MVC application's model to load a table of dropdown options. When the selected dropdown value changes, I need to track that change in the model. I tried using the subscribe option on the element in the…
Rafiki
  • 630
  • 1
  • 8
  • 22
0
votes
1 answer

Binding data synchronous or asynchronous

Are the binding functions synchronous at knockout.js? Would I get always the data in my getDeliveryNote function in this example? function myModel(){ var self = this; self.orders = ko.observable(); self.selectAndClick = function(data){ …
Alvaro
  • 40,778
  • 30
  • 164
  • 336
0
votes
1 answer

Why is component being disposed in params change?

According to ko's component documentation on a component lifecycle: If the component binding’s name value changes observably, or if an enclosing control-flow binding causes the container element to be removed, then any dispose function on the…
0
votes
1 answer

Prevent load data again on component change with knockout.js

I'm using components to change between one or another view. That's what I was recommended to do. Now every time I change between views the data is being loaded again. Here's a reproduction of the issue. (Check the console). It is not such a big deal…
Alvaro
  • 40,778
  • 30
  • 164
  • 336
0
votes
1 answer

Create observable object properties inside an array in knockout.js

Knockout.js docs says about observableArray Simply putting an object into an observableArray doesn’t make all of that object’s properties themselves observable. Of course, you can make those properties observable if you wish, but that’s an…
Alvaro
  • 40,778
  • 30
  • 164
  • 336
0
votes
1 answer

Firing actions after foreach finishes in knockout.js

I've seen this question and this other one about the topic, but none of them seem to solve my problem. I'm trying to initialize a javascript plugin (BootStrap javascript tooltip) for an element within each row of a table. To do it, the table has to…
Alvaro
  • 40,778
  • 30
  • 164
  • 336
0
votes
1 answer

Displaying nested JSON as nested list using knockout.js

I have a nested JSON like this: [ { "Run 1": { "1.2.0": { "Server": { "TestSuite 1": [ { "version": "1.2.0", …
Bharat
  • 2,960
  • 2
  • 38
  • 57
0
votes
2 answers

Passing a template into custom knockout binding

I would like to make a popover (bootstrap) custom binding. I have defined this like so: ko.bindingHandlers.popover = { update: function (element, valueAccessor) { var template = ko.unwrap(valueAccessor); …
4imble
  • 13,979
  • 15
  • 70
  • 125
-1
votes
1 answer

Knockout.js won't be recognized after using require.js

Calling require.js before knockout.js throws the following message: Uncaught ReferenceError: ko is not defined Assuming I have knockout.js at the very top of the combined file, I have this: