老猪的成果 :wink: :wink: :wink:
对全选的处理:
// 重写multiselector
myMultiselect = Ext.extend(Ext.ux.Multiselect, {
onViewClick : function(vw, index, node, e) {
var arrayIndex = this.preClickSelections.indexOf(index);
if (arrayIndex != -1) {
this.preClickSelections.splice(arrayIndex, 1);
this.view.clearSelections(true);
this.view.select(this.preClickSelections);
}
// store initial value
var initialStr = this.hiddenField.dom.value;
this.fireEvent('change', this, this.getValue(),
this.hiddenField.dom.value);
this.hiddenField.dom.value = this.getValue();
this.fireEvent('click', this, e);
this.validate();
// get new value
var newStr = this.hiddenField.dom.value;
// add conditions here
if (arrayIndex == -1) {
this.setValue(initialStr + this.delimiter + newStr);
}
}
});
对全选的处理:
tbar : ['-', {text : '全选',
handler : function() {var result = "";
for (var i = 0; i < drugTypeStore.getCount(); i++) {
result += drugTypeStore.getAt(i).get('code') + ",";
}
if (result.length > 0) {
result = result.substring(0, result.length - 1);
}
isForm.form.findField('multiselector').setValue(result);}},'-']