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
0
votes
0 answers

Knockout computed variables from loop stuck on last iteration

I'm trying to achieve something like this: for (var i = 0; i < types.length; i++) { var type = types[i]; myObj()['text' + type.name] = ko.computed(function () { return myFuction(myObj()[type.name + 'MyText']()); }); } If that's…
Nicolas
  • 356
  • 1
  • 5
  • 17
0
votes
0 answers

Problems with observable property

I have a ViewModel with some filters properties: class IndexModel TermoBusca: ko.observable() class ViewModel extends IndexModel Nome: ko.observable() Endereco: ko.observable() Contato: ko.observable() Responsaveis:…
ridermansb
  • 10,779
  • 24
  • 115
  • 226
0
votes
1 answer

How to get the observable property's value in the computed property in Knockout-Validation

I use the Knockout-Validation framework to validate the viewModel. I have a viewmodel defined following: ko.validation.init({ decorateElement:true, errorElementClass: 'invalid', insertMessages: false }); var viewModel =…
0
votes
1 answer

knockout.js computed function to create two arrays?

I have an array of objects that a user can perform search on. I'm using a ko.computed function based on the search to create another array of matched items for display. self.matchedRecords = ko.computed(function() { return…
whiteatom
  • 1,456
  • 2
  • 14
  • 33
0
votes
2 answers

knockout 2: how to do computed value on each item in observable array.

Hi i have an observable array this.item = ko.observableArray({ tax: ko.observable(8.0); price: ko.observable(100.00); eachTotal: ko.computed(function() { this.tax() * this.price(); }); }); I am getting error saying…
0
votes
1 answer

Knockout.js: Getting computed observable to return array for use with select options

Basically, what I am trying to achieve is to populate a dropdown based on the value of another dropdown in Knockout.js My view code(stripped obviously):
0
votes
1 answer

Knockout computed on slice of an observable array, is this posible

I am attempting to provide a mechanism for editing entries in an observable array. The display would have two sections. The first is the array entries displaying a limited number of fields, and the second would allow the user to edit all fields for…
0
votes
1 answer

Computed observable dynamic variable

I have an input field that should be populated dynamically when a selectbox changes it's value. So, I binded the variable to the input and another value to the selectbox's selected value. Now I want to be able to change the input value…
Stefano
  • 3,213
  • 9
  • 60
  • 101
0
votes
1 answer

Custom throttle extender in knockout.js

I have an observable that's binded to some input, and sometimes it's value changes too fast, so that the end user does not have time to read it. So I want to restrict the speed of changes in input. But it's not a throttle, because throttle is a…
Kasheftin
  • 7,509
  • 11
  • 41
  • 68
0
votes
1 answer

knockout - subtract values in an array

I'm having a little trouble with the following. I'm using knockout to edit a list containing nested lists, a little like the Contacts Editor on the knockout website: http://knockoutjs.com/examples/contactsEditor.html In my example as follows the…
ledragon
  • 299
  • 6
  • 17
0
votes
1 answer

Why Can't I Use ko.computed() in Knockoutjs?

I am new to using knockoutjs and I encountered this problem when using .computed() here is my HTML Code:
0
votes
2 answers

Computed value always returning a true-ish value even when parent property is null

I'm using the ko mapping plugin to create my observables from a JS object, ko.mapping.fromJS(). A snippet of the object is below: { Name: "blah", Parent: { Title: "blah", Url: "/blah" } } If Parent.Title changes then everything on my page is…
Colin
  • 2,442
  • 5
  • 24
  • 30
1 2 3
8
9
Product Name Price