wakanda

Wakanda query with dynamic attribute name in a variable


Please, take a look at following code:

var platNom = "apero"; // I set the value of my attribute in one variable
var monAttribut = ds.Convives.attributes[platNom]; //this works
var invitants = ds.Convives.query("$(this[platNom] == 'oui') ", {allowJavascript: true});// This does not work

Is there a problem in my syntax?


Solution

  • If I understand correctly you would like to use attribute variable to construct the query string. Then you can do this by simply reference platNom directly. The correct syntax should be:

    var invitants = ds.Convives.query(platNom + " == 'oui'")