Extjs 在存储区的加载前丢失变量
我有一个商店,我使用三种不同的方式-从我的数据库中搜索、编辑和删除垃圾箱。 存储区需要bin的Beforeload变量:Extjs 在存储区的加载前丢失变量,extjs,extjs4,Extjs,Extjs4,我有一个商店,我使用三种不同的方式-从我的数据库中搜索、编辑和删除垃圾箱。 存储区需要bin的Beforeload变量: BinDetailsStore.on('beforeload', function() { BinDetailsStore.getProxy().extraParams = { bin: bin } }, this); 通过另一个功能,我还能够从成功添加的bin中调出bin详细信息: ... button.up
BinDetailsStore.on('beforeload', function() {
BinDetailsStore.getProxy().extraParams = {
bin: bin
}
}, this);
通过另一个功能,我还能够从成功添加的bin中调出bin详细信息:
...
button.up('form').submit({
clientValidation: false,
url: 'binsites/addbin?bin=' + bin + '&size=' + size + '&bintype=' + bintype + '&stat=' + stat + '&bpid=' + bpid + '&rte=' + rte,
success: function() {
Ext.Msg.alert('Bin Added', 'Bin ' + bin + ' added');
deleteFlag = false;
BinDetailsStore.load();
popBinAdd.close();
popBinAdd = null;
}
});
但是,当我编辑垃圾箱的详细信息并尝试以这种方式重新加载存储时
...
button.up('form').submit({
url: 'binsites/editbin?bid=' + bid + '&size=' + newSize + '&type=' + newType + '&bin=' + bin,
success: function() {
Ext.Msg.alert('Bin Saved', 'Bin ' + bin + ' has been saved');
//Ext.Msg.alert(bin);
editFlag = false;
binEdForm.close();
binEdForm = null;
BinDetailsStore.load();
}
});
详细信息保存并调用成功调用,但在命中beforeload事件时,我丢失了bin的值。
我曾尝试在success函数中重新定义bin,并将bin传递给另一个函数,以调用BinDetailsStore bin transfers to new函数上的加载,但由于beforeload而再次丢失,但无济于事
Bin的定义如下:
BinDetailsStore.on('load', function() {
if (deleteFlag) {
bin = null;
bid = null;
size = null;
bintype = null;
stat = null;
this.binDelConfirm(bin, bid, size, bintype);
} else if (editFlag) {
bin = null;
bid = null;
size = null;
updated = null;
bintype = null;
stat = null;
desc = null;
this.binEditForm(bin, bid, size, updated, bintype, stat, desc);
} else {
this.loadSearchResults();
}
}, this);
由于editFlag处于活动状态,因此它将传递给binEditForm:
binEditForm: function(bin, bid, size, updated, bintype, stat, descr) {
if (binEdSer) {
binEdSer.close();
binEdSer = null;
}
if (binEdForm) {
binEdForm.close();
binEdForm = null;
}
if (binResult) {
binResult.destroy();
binResult = null;
}
if (cusResult) {
cusResult.destroy();
cusResult = null;
}
if (!bin && !bid && !size && !updated && !bintype && !stat && !desc) {
if (BinDetailsStore.getTotalCount()) {
rec = BinDetailsStore.getAt(0);
bin = rec.get('number');
bid = rec.get('id_');
size = rec.get('size');
updated = rec.get('updated');
bintype = rec.get('bintype');
if (rec.get('cust_type') == 'Park' || rec.get('cust_type') == 'Truck') {
stat = rec.get('cust_type') + ' - ' + rec.get('park');
} else {
stat = rec.get('cust_type');
}
desc = rec.get('desc_');
}
}
简而言之,我想知道当BindeTailsStoreBeforeLoad事件被触发时,bin的值为何消失
感谢您抽出时间,我们非常感谢您的帮助。您的问题确实不清楚,不确定问题是什么。对不起,我在调用BinDetailsStore.load时丢失了bin的值。我想知道为什么会这样。因为你在某处覆盖了它。你需要追踪你的代码并找出它。如果不能运行它,没有人会告诉你。我在成功调用中测试了bin,它仍然有它的值,然后在我设置beforeload中的额外参数之前,它的值为null。在Chrome中的代码上放置分隔符表明,在到达my beforeload获取额外参数之前,一旦退出ext all代码中的成功调用,值就会变为null。就我所知,我不是那个重写变量的人。