EXT JS6 递归调用 Store
EXT JS6 calling Store recursively
是否可以递归调用Store reload:
fetchData: function (sDate, priorDay) {
store = Ext.getStore('OutOfBalanceList');
store.reload({
params: {
startDate: searchForm.startDate,
endDate: searchForm.endDate,
cusip: searchForm.cusip,
account: searchForm.account
},
callback: function (records, options, success) {
if (records.length == 0) {
var pdate = priorDay;
priorDay.setDate(pdate.getDate() - 1);
sDate.setValue(priorDay);
searchForm.startDate = Ext.Date.format(sDate.value, 'm/d/Y');
fetchData(sDate, priorDay);
}
}
});
由于在 Store 构造中似乎缺少 Sync 功能,也许我可以通过递归调用获得相同的东西。
如果是这样,谁能帮助我正确构建调用。我收到错误:“Uncaught ReferenceError: fetchData is not defined”。
您在哪里声明函数 fetchData ?
从结构上看fetchData函数声明在一个对象中:
var plop = {
...
fetchData: function() {
...
}
}
如果是这种情况,你需要在声明函数的范围内调用你的函数
var扑通= {
获取数据:函数(...){
...
plop.fetchData(...)
}
}
对于你的情况,我建议创建一个单例 class 或类似的东西,其中包含你的方法 fetchData。
如果还没有解决您的问题,希望对您有所帮助。
是否可以递归调用Store reload:
fetchData: function (sDate, priorDay) {
store = Ext.getStore('OutOfBalanceList');
store.reload({
params: {
startDate: searchForm.startDate,
endDate: searchForm.endDate,
cusip: searchForm.cusip,
account: searchForm.account
},
callback: function (records, options, success) {
if (records.length == 0) {
var pdate = priorDay;
priorDay.setDate(pdate.getDate() - 1);
sDate.setValue(priorDay);
searchForm.startDate = Ext.Date.format(sDate.value, 'm/d/Y');
fetchData(sDate, priorDay);
}
}
});
由于在 Store 构造中似乎缺少 Sync 功能,也许我可以通过递归调用获得相同的东西。
如果是这样,谁能帮助我正确构建调用。我收到错误:“Uncaught ReferenceError: fetchData is not defined”。
您在哪里声明函数 fetchData ?
从结构上看fetchData函数声明在一个对象中:
var plop = {
...
fetchData: function() {
...
}
}
如果是这种情况,你需要在声明函数的范围内调用你的函数
var扑通= {
获取数据:函数(...){
...
plop.fetchData(...)
}
}
对于你的情况,我建议创建一个单例 class 或类似的东西,其中包含你的方法 fetchData。
如果还没有解决您的问题,希望对您有所帮助。