this.loadSmt = function(argPanel)
{
this.store1 = new Ext.data.JsonStore({
url : 'URL1',
totalProperty : 'total',
successProperty : 'success',
root : 'root1',
fields : [
{name: 'data1'},
{name: 'data2'}
]
});
this.store2 = new Ext.data.JsonStore({
url : 'URL2',
totalProperty : 'total',
successProperty : 'success',
root : 'root2',
fields : [
{name: 'data21'},
{name: 'data22'},
{name: 'data23'},
{name: 'data24'},
{name: 'data25'}
]
});
this.store1.on('beforeload', function() {
this.store1.baseParams = {
argID: myID
};
}, this);
this.store2.load({
callback : function() {
var graphOwner = argPanel;
var graphDataArr = [];
var i = 0;
this.data.each(function(item, index, totalItems) {
var data1 = item.data['data1'];
var data2 = item.data['data2'];
// create arraystore data for graph
var tempArr = new Array();
tempArr.push(data1);
tempArr.push(data2);
graphDataArr[i] = tempArr;
i++;
});
this.GraphPanel = this.getMyGraph(graphDataArr);
}
}, this);
};
this.getMyGraph = function(argGraphValue)
{
// do something
}
quando si esegue questo codice ottengoCome utilizzare la portata in funzione del carico negozio in ExtJS
TypeError: this.getMyGraph is not a function
errore, quando uso
funzionethis.data.each
nel negozio di callback, posso' t utilizzare
this.getMyGraph
funzione. Penso che questo sia un problema di ambito, come posso passare l'ambito come parametro a una funzione o come posso risolvere questo errore?
cambio il mio codice come si mostra. Ora visualizzo l'errore "TypeError: this.data isdefinito". – vtokmak
Cambiare la firma del callback a 'callback: function (record, operazione, successo)' e utilizzare i record this.data invece – Damask
ha funzionato. grazie mille @Prodigy – vtokmak