How to bind to store size?
After store load, view is not updated.
I use formula to achieve this, because adding braces in bind descriptor causes errors:
WORKING fiddle:
http://ift.tt/1ifUu3l
(there are multiple files)
There is numStations formula that additionaly shows number of function call.
Expected bind results after store load:
Items List (total: 10) / call counter: 2
Current results:
Items List (total: 0) / call counter: 1
After store load, view is not updated.
I use formula to achieve this, because adding braces in bind descriptor causes errors:
Code:
Ext.define('cas.view.stationlist.StationListModel', {
extend: 'Ext.app.ViewModel',
alias: 'viewmodel.stationlist',
data: {
name: 'stations list model',
callCounter:0
},
stores: {
stations: {
source: 'Stations',
autoLoad: true
}
},
formulas: {
numStations: function (get) {
var count = get('stations').getCount();
var str = "Station (" + count + ")";
this.set("callCounter", this.get('callCounter')+1)
return str + " / call counter: "+this.get('callCounter');
}
}
});
WORKING fiddle:
http://ift.tt/1ifUu3l
(there are multiple files)
There is numStations formula that additionaly shows number of function call.
Expected bind results after store load:
Items List (total: 10) / call counter: 2
Current results:
Items List (total: 0) / call counter: 1
Aucun commentaire:
Enregistrer un commentaire