Questions tagged [computed-values]

20 questions
20
votes
4 answers

Swift - Associated value or extension for an Enum

General question regarding swift enum. I want to create an enum of "icon" and "associate" a value to the enum case enum Icon { case plane case arrow case logo case flag } I want to create an associated image to the enum's value. And also…
Avba
  • 14,822
  • 20
  • 92
  • 192
3
votes
2 answers

How do you add installation related computed strings to InnoSetup scripts?

Currently when I upgrade a program I backup the existing files to a folder named backup in the program directory eg . Source: "{app}\filename.exe"; DestDir: "{app}\backup"; Flags: external skipifsourcedoesntexist uninsneveruninstall Is there a way…
vfclists
  • 19,193
  • 21
  • 73
  • 92
3
votes
2 answers

Getter computed property vs. variable that returns a value

Is there a difference between a getter computed property and variable that returns a value? E.g. is there a difference between the following two variables? var NUMBER_OF_ELEMENTS1: Int { return sampleArray.count } var NUMBER_OF_ELEMENTS2: Int…
Daniel
  • 3,758
  • 3
  • 22
  • 43
2
votes
1 answer

Knockoutjs + ko.mapping.fromJS + computed field not calculate computed

I try to do this: myData = {weight: 100, anotherWeight: 120.55}; // when my data is plain json - all work $.when($.getJSON(url, {param}, function(data) {myData = data} ). //when i got it from ajax - dosn't work then(function(){ var taskModel…
1
vote
4 answers

Computed array values in C# - reactive programming

Example 1 As we know there's the concept of computed columns in databases where a column is computed based on adjacent columns' values. The problem is that computed columns can't relate to other rows than current. Example 2 Then we have spreadsheets…
1
vote
1 answer

Fetch the data of parent model into static::saving() boot function

I want to use data from the parent model to run the saving() function in the child model Previously, I inserted a computed data to the table in model "Loan" but now I need to insert it into a child model "InterestAmount" Loan.php use…
1
vote
1 answer

Same style values, same element but different computed values on same browser

I am working on a chrome extension which returns the font-size property of any element. I am loading the ajax response data into the extension document and computing their properties. Now something strange happening and I'm not being able to find…
Ali Baig
  • 3,819
  • 4
  • 34
  • 47
1
vote
1 answer

Count number of users in ember.js

I have an ember application which keeps track of a collection of users. I have a computed property which is supposed to keep track of the number of users in the system in my usersController.js: App.UsersController = Ember.ArrayController.extend({ …
bookthief
  • 2,443
  • 8
  • 41
  • 54
1
vote
1 answer

Error with sum up values in a row using knockout.js and ko.computed

I think this a really basic problem but I just don't see the error. I got the following simple Model: var Row = function(col1, col2) { var self = this; self.column1 = ko.observable(col1); self.column2 = ko.observable(col2); self.sum…
Marko
  • 93
  • 5
0
votes
1 answer

How to set up a computed var in Vue to change the vue-bootstrap badge variant color

I am attempting to set up a computed var in Vue to set the variant of a bootstrap badge tag depending on data being returned from a JSON file. I set up the response returned from the JSON file to be passed to an array called configData. I…
JS_is_awesome18
  • 1,587
  • 7
  • 23
  • 67
0
votes
1 answer

How can I analyze Ember Data array elements (computed property?)?

I want to create unique abbreviations for each element of an array of Ember Data records. For example, suppose we have the following records in the Persons table: name: Mike Jones department: IT name: Mike Smith department: IT name: John…
ed94133
  • 1,477
  • 2
  • 19
  • 40
0
votes
1 answer

Div has image's real width instead of computed width

I have several div elements which contain images, every image's height is set to 100%, width is calculated. Height works fine, but the parent div has image's real width, wich is larger then computed width. That makes gaps between the images. How can…
0
votes
1 answer

Computed property in Emberjs Model

Suppose we have a model like this: App.Somemodel = DS.Model.extend({ A:DS.attr('number'), B:DS.attr('number'), CP: function(){return this.get('A') + this.get('B');}.property('A','B') }) My question is this :When is CP going to be re…
adam
  • 19
  • 5
0
votes
1 answer

Ember JS computed property binding to child of hasMany

I have the following models: Variant = DS.Model.extend value: DS.hasMany('value') compiledValues: (-> @get('values').map((v,i,e) -> v.get('option').get('name') + ' : ' + v.get('value') ).join("\n") …
DEfusion
  • 5,533
  • 5
  • 44
  • 60
0
votes
1 answer

Ember.js Controller with computed property not being recomputed

I'm trying to add permissions to groups, and I have a drag and drop set up so that a user can pull the unselected permissions over to selected, or vice versa. Unselected permissions are computed via removing the selected permissions from all…
Jim MacKenzie
  • 222
  • 4
  • 16
1
2