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

Computed stops triggering forever if dependency is inside of false branch statement

I'm faced a problem that my computed observable stops triggering after some sequence of dependency changes. Finally I found out the point: if dependency was inside of false branch statement during latest evaluation, computed will not be triggered…
shameleo
  • 344
  • 2
  • 13
3
votes
1 answer

ko computed not showing in view

I have some problems regarding binding to computed value. I am showing data in table, and summing up some fields. In footer I want to display the sum of those fields, and the empty column, as well as one with text of total. The values get stored…
Hugibeer
  • 87
  • 1
  • 5
3
votes
2 answers

knockoutjs child object trigger change in parent computed

Is there an easier way to get a parent object's 'subscribe' to fire with changes to any of the lower level observables? The following code and sample fiddle are working, but it requires me to duplicate my masterOptions in optionSet. This smaller…
NickNuke
  • 303
  • 2
  • 10
3
votes
1 answer

Binding a property that could be of multiple data types in Knockout

So I have a custom knockout binding for handling time durations. I have an issue where a value in one of my forms might be a duration, but could also be a string or other value. The issue arises from the fact that duration values are represented as…
3
votes
2 answers

How can I force a throttled observable to update immediately?

I show or hide a "Loading" indicator on my UI by binding its visibility to an observable named waiting, which is defined like this: // Viewmodel var outstandingRequests = ko.observable(0); // true if any requests are outstanding var waiting =…
Brant Bobby
  • 14,956
  • 14
  • 78
  • 115
3
votes
2 answers

knockout.js computed array not firing on change

I am trying to create an editable grid with a computed observableArray in MVC 4 and Knockout.js. The computed() method gets called when the array is first loaded but not when any data changes on the grid via user editing. The ViewModel: function…
Steve
  • 1,557
  • 2
  • 17
  • 34
3
votes
1 answer

Knockout computed observable won't update after initializing nested data

I'm trying to implement a HasOpenIssues computed observable that binds to a UI element that updates if any member of a nested observableArray meets a condition, and can't get it to work. I'm using KO 2.2.0. My viewmodel has an observableArray of…
Val
  • 2,291
  • 7
  • 34
  • 63
2
votes
1 answer

Mobx only re-render item when computed value changes

I have a list of medias and my goal is to be able to show the currently playing media. To do so, I compare the playing media ID with the one from the list to apply the correct style. My issue is that when clicking on another item, all items…
2
votes
2 answers

Vue computed setter get not triggered for array in v-model

I have a string pipe of values, which I want to modify. the string pipe has a range from 0-5 values, so I made the following: new Vue({ el: '#app', data: { valuesString: "" }, computed: { values: { get() { var…
2
votes
2 answers

ko.computed do not fire function upon instantiating

Hi is there a way to not fire the function when instantiating a ko.computed example is i have this ko.computed ko.computed(function(){ alert(this.Test); } , this); so basically if i instantiated this computed this will fire the function defined…
Don
  • 131
  • 1
  • 10
2
votes
1 answer

Computed property not updating in aurelia

Currently I try to reevaluate my "enabled" property but its not re-computed after I change either pages or pageIndex. page.js export class Test { pageIndex = 0; pages = 2; constructor() { this.items = [ …
l1e3e3t7
  • 124
  • 11
2
votes
1 answer

How to use a base KO observable array to update multiple computed observable arrays bound to select option drop downs

I have an observable array with available items that was bound to a select dropdown box in a grid row. Users can add more rows with drop downs and select items in each of them. The issue is once an item is selected in a dropdown row, it should not…
2
votes
2 answers

Animated transition beforeRemove/afterAdd when foreach with computed observable

I am facing some challenges trying to use jquery animations such as fadeIn() fadeOut() with knockout. Live example, without animation: http://jsfiddle.net/LkqTU/23801/ I use a computed observable to filter my original array of charities. The…
jonasjuss
  • 173
  • 1
  • 2
  • 10
2
votes
4 answers

Inheritance and overriding Knockout computed observable

I've been working on making my javascript app more scaleable. The app uses knockout.js to bind a grid of some type of database item to be editted and updated by the user. I'm now going down the path of working with inheritance and having a BaseModel…
2
votes
1 answer

Knockout Modifying ObservableArray inside Computed

I am trying to solve the problem where I have a two way computed observable and want that parsed into an observable array and have that change event bubble up. The problem is that the it appear to not be notifying subscribers. Its best shown in…
1
2
3
8 9