I need to update my ListView constantly but, for some reason, I couldn't identify yet, I haven't been successful doing so.
dash.xml
<ListView id="pilotList" items="{{ activeList }}">
<ListView.itemTemplate>
<GridLayout columns="*,*2,*">
<Label text="{{ listNick }}" col="1" class="listNick" />
<Label text="{{ listDistance }}" col="2" class="listDistance" />
</GridLayout>
</ListView.itemTemplate>
</ListView>
dash.js (I am extracting just the related parts here):
var observable = require("data/observable");
var pageModule = require("ui/page");
var activePilots = []; //this is the array with the contents
exports.pageLoaded = function(args) {
page = args.object;
pilotList = page.getViewById("pilotList");
page.bindingContext = { activeList:activePilots };
}
Later on in the code (every time a location change), I update the activePilots array:
activePilots.push({listNick:fbMi, listDistance:result.value[uid]["uid"] })
So far, everything is working as I can see with the console.log(JSON.stringify(activePilots)).
However, the ListView never updates, even forcing the
pilotList.refresh();
Any ideas of what I am doing wrong? Thanks, Alex