Questions tagged [computed-observable]

A computed observable is a synchronously updated value based on other observables; if they change so does the computer observable, immediately. A term frequently used with Knockout.js.

A familiar computed observable would be a cell in a spreadsheet that contains the sum of a column. If any of the cells in the column change, the sum is immediately updated.

Reference: http://knockoutjs.com/documentation/computedObservables.html

132 questions
1
vote
2 answers

How to calculate a total in a grid with breeze.js extended entities?

I am working on an MVC web application using the MVVM pattern, breeze.js and knockout.js. This is the first time I use these js libraries and I still have to grasp how they work. One of the pages of the application has a grid where both columns and…
1
vote
3 answers

knockout.js - when do computed items recalculate dependencies?

Suppose you have the following js: var vm = { objects: ko.observable([]), objectCount: ko.computed(function(){ return vm && vm.objects().length; }), add: function() { var current = vm.objects(); current.push({});…
George Mauer
  • 117,483
  • 131
  • 382
  • 612
1
vote
1 answer

knockout.js dynamic field binding with variable

Is there a way to dynamically replace the field being written to and read from in the ko.computed? For example, with this function, I want to replace the self.JobStartDate with a variable fieldname that I could pass in: function Job(data) { …
Adam Levitt
  • 10,316
  • 26
  • 84
  • 145
0
votes
1 answer

How can I rerender when object (a dictionary) changes?

I have the following .hbs
{{#each this.sortedDictionary as |item|}} {{item.name}}
{{/each}} and the corresponding .js code for it: import Component from…
0
votes
1 answer

Why is my Knockoutjs Computed Observable Not Working when my Observable Array is being Sorted?

Background Info I have an Observable array with three item details in it. Each item detail has the following properties; Item, Group, TotalQTY and InputQty. When the user enters the Input Quantity and it matches the Total Quantity the item will be…
WebDevKris
  • 93
  • 1
  • 1
  • 7
0
votes
2 answers

Knockout Computed Observable Not Updating after reading stored value

I am using a Knockout computed observable to store data from my users in the following fashion: var DummyClass = (function() { userPrefs = ko.observable({ value1: 0, value2: 0, value3: 0}); commonPrefs = ko.observable({ …
CMInfinite
  • 13
  • 3
0
votes
1 answer

Change value attribute of checkbox base on checked value with knockout JS

I'm trying to a checkbox and send the value YES or NO in my submitted form, base in if is checked or no but the value is not updated here is my code: self.checkbox = ko.observable("No"); self.is_checked = ko.computed({ read: function…
UserEsp
  • 415
  • 1
  • 7
  • 29
0
votes
1 answer

Computed Knockout JS function seems not unbind in firefox for keypress event

I'm using the following function with knockout self.navigateToSection = ko.pureComputed({ read: function() { return this; }, write: function(data, event) { if (event.type == "keydown") { …
UserEsp
  • 415
  • 1
  • 7
  • 29
0
votes
0 answers

Knockout: deferUpdates very slow

I have a knockout application with hundreds of computedObservables. If I turn off deferUpdates, updates are slow but manageable (+- 1sec on my machine). However, if I turn on deferUpdates, this turns into 68 seconds, during which chrome is…
bspoel
  • 1,567
  • 2
  • 13
  • 22
0
votes
1 answer

Knoockout computed observable doesnt update

The following is a computed observable, and i am calling its write function, but the write doesnt update the value for the computed. self.pagesToBeDisplayed = ko.computed({ read: function () { var value = otherFile.PerformWork(); …
0
votes
1 answer

Observable Array doesn't reset in Knokcout

I have an observable array as: self.myArray = ko.observableArray([1234]); I am trying to clear an observable array as two different ways: self.myArray([]) // Step X self.myArray.removeAll() // Step X But the value isn't emptied, and then I have to…
0
votes
1 answer

Knoockout computed observable write doesnt update

The following is a computed observable, and i an calling its write function, but the write doesnt update the value for the computed. self.pagesToBeDisplayed = ko.computed({ read: function () { return self.pages(); }, write: function…
0
votes
1 answer

How to update variables that are inside a helper body in an Ember template

Imagine a property myNumber in a controller that has a different random number every second. With this template you will see this change every second:

Random number

{{myNumber}}

However, when the number is only referenced inside a…
0
votes
1 answer

Knockout - show checkbox based on pick-list selection in a table

I am trying to make a checkbox show/hide based on the picklist selection for each row in a table. The picklist options are displayed correctly but the computed function is not updating the visibility of the check box after changing the option…
0
votes
1 answer

Sort Knockout's computed only once in data-bind foreach

so here my problem is that I want knockout's foreach to display my computed array of objects in descending order according to one value per object (totalTTC of Order). And I dont want this order to change even if the totalTTC in an order change when…
KroBlan
  • 1
  • 4
1 2 3
8 9