Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejs
themeEclipse
var self = this.ractive;
this.ractive.fire("obtainData");
var count = 0;
this.ractive.on("upOne", function(event){
    console.log("right");
    var roomT = this;
    var roomSP = this;
    count += 1;
    console.log(count);
    
finstack.eval('readAll((navName=="Room Temp") and floorRef->dis=="Floor 1" and siteRef->dis=="City Center" and equipRef->navName=="Vav-0(' +count+ ')")', function(data){
roomT.myTemp=data.result.toObj()[0];
});
finstack.eval('readAll((navName=="Room Setpoint") and floorRef->dis=="Floor 1" and siteRef->dis=="City Center" and equipRef->navName=="Vav-0(' +count+ ')")', function(data){
roomSP.mySetPoint=data.result.toObj()[0];
});
    console.log(target);
});

this.ractive.on("downOne", function(event){
    console.log("left");
});

this.ractive.on("increment", function(event){
    var point   = this.get('mySetPoint');
    var val     = parseFloat(point.curVal);
    val += 1;
    if (val >= 84)
    val=84;
    if (val <= 0)
    val=0;
    finstack.eval('readById(' +point.id+ ').pointOverride(' +val+ ')').then(function(data) {
       if (data && data.result) {
           if (data.result.isErrorGrid) {
                console.error("Error occurred while updating value");
                return;
           }
          self.set('mySetPoint.curVal', val);
       } 
    }, function(err) {
        console.error("Error occurred while updating...", err);
    });
});

this.ractive.on("decrement", function(event) {
    var point   = this.get('mySetPoint');
    var val     = parseFloat(point.curVal);
    val -= 1;
    if (val >= 84)
    val=84;
    if (val <= 0)
    val=0;
    finstack.eval('readById(' +point.id+ ').pointOverride(' +val+ ')').then(function(data) {
       if (data && data.result) {
           if (data.result.isErrorGrid) {
                console.error("Error occurred while updating value");
                return;
           }
           self.set('mySetPoint.curVal', val);
       } 
    }, function(err) {
        console.error("Error occurred while updating...", err);
    });
});

this.ractive.on("actions", function(event) {
    var item    = this.get(event.keypath);
      var mainWin = window.parent;
     try {
        mainWin.app.ShowActionsFor (item.id);
        } catch (err) {console.error(err)}
});

...