onLoad : function() {
Dma.common.DmaCommon.superclass.onLoad.call(this);
//给下拉列表添加SELECT ALL
var snapshot = this.store.snapshot || this.store.data;
var f = true;
snapshot.each(function(r){
if(r.get(this.displayField) == this.selectAllTxt){
f = false;
}
},this);
if(f){
var rec = new Ext.data.Record();
rec.set(this.displayField, this.selectAllTxt);
this.store.insert(0, rec);
}
/*if (this.flag == 0 && this.check) {
if(this.displayAll){
var rec = new Ext.data.Record();
rec.set(this.displayField, this.selectAllTxt);
this.store.insert(0, rec);
}
} else if (this.check) {
var i = 0;
var snapshot = this.store.snapshot || this.store.data;
snapshot.each(function(r) {
if (r.get(this.displayField) == this.selectAllTxt) {
i = 1;
}
}, this);
if (i != 1) {
this.flag = -1;
}
}
this.flag++;*/
/*if(this.check && this.value!=null){
//如果是在表格中,当前的value中有值,则点击展开下拉列表时要把下接列表中的相应部份选中,多个值的情况下用逗号分隔
var rst=this.value.split(this.separator);
var snapshot = this.store.snapshot || this.store.data;
snapshot.each(function(r) {
if(r.get(this.displayField) == this.selectAllTxt){
if(this.hasSelectAll)
r.set(this.checkField, true);
else
r.set(this.checkField, false);
} else{
for(var i=0;i<rst.length;i++){
if(rst[i]==r.get(this.displayField) || rst[i]==r.get(this.valueField)){
r.set(this.checkField,true);
break;
}else{
r.set(this.checkField,false);
}
}
}
},this);
}*/
},
expand: function(){
Dma.common.DmaCommon.superclass.expand.call(this);
if(this.check ){
var val = this.value == null ? '': this.value;
var rst=val.split(this.separator);
var snapshot = this.store.snapshot || this.store.data;
snapshot.each(function(r) {
if(this.hasSelectAll){
r.set(this.checkField, true);
} else{
for(var i=0;i<rst.length;i++){
if(rst[i]==r.get(this.displayField) || rst[i]==r.get(this.valueField)){
r.set(this.checkField,true);
break;
}else{
r.set(this.checkField,false);
}
}
}
},this);
}
},
checkSelectAll: function(){
var snapshot = this.store.snapshot || this.store.data;
snapshot.each(function(r) {
if(r.get(this.displayField) == this.selectAllTxt){
if(this.hasSelectAll)
r.set(this.checkField, true);
else
r.set(this.checkField, false);
return false;
}
},this);
},
isSelectAll: function() {
return this.hasSelectAll;
},
getHiddenValue: function(){
return this.hiddenValue;
}
});
Ext Combobox
最新推荐文章于 2021-08-06 11:37:01 发布