实现:
1.添加选项时,对于超长的内容做一次截取操作
2.截取之后,给comboBox增加tip提示
var userGroupComBox = new Ext.form.ComboBox({
id : "userGroupComBox",
name : 'userGroupComBox',
triggerAction : 'all',
displayField : 'value', //comboBox显示值
valueField : 'value',
mode : 'remote',//这里使用了远程模式,用来从数据库获取数据并显示
// mode : 'local',
width : 180,
loadingText : "please waitting", //加载等待提示语
editable : true,
typeAhead : false,
minChars : 1,
store : (proVersion == is9X) ? childStore : [["", ""]],
listeners : {
// 验证用户输入的用户群是否正确
blur : function(combo, record, index) {
},
select:function (combo, record, index){
if (combo.value == "...") {
userGroupComBox.setValue("");
}
}
}
选择项超长时截取并给予tip提示
//截取JSON Store中的数据,并给予tip提示
function splitUserGroupValue(store){
var splitStore=new Ext.data.Store({});
for ( var i = 0; i < store.length; i++) {
var dataName=store[i].data.value+"";
var dataValue=getEllipsis(store[i].data.value,32)+"";
splitStore.add(new Ext.data.Record({
name : dataValue,
value : dataName
}));
}
return splitStore;
}
tip提示对象
var tpl = new Ext.XTemplate(
'<tpl for="."><div class="x-combo-list-item"><span style="backgroud-color:#646464;" ext:qwidth="auto" ext:qtip="{value}"> {name} </span></div></tpl>'
);
userGroupComBox.tpl=tpl;
1.添加选项时,对于超长的内容做一次截取操作
2.截取之后,给comboBox增加tip提示
var userGroupComBox = new Ext.form.ComboBox({
id : "userGroupComBox",
name : 'userGroupComBox',
triggerAction : 'all',
displayField : 'value', //comboBox显示值
valueField : 'value',
mode : 'remote',//这里使用了远程模式,用来从数据库获取数据并显示
// mode : 'local',
width : 180,
loadingText : "please waitting", //加载等待提示语
editable : true,
typeAhead : false,
minChars : 1,
store : (proVersion == is9X) ? childStore : [["", ""]],
listeners : {
// 验证用户输入的用户群是否正确
blur : function(combo, record, index) {
},
select:function (combo, record, index){
if (combo.value == "...") {
userGroupComBox.setValue("");
}
}
}
选择项超长时截取并给予tip提示
//截取JSON Store中的数据,并给予tip提示
function splitUserGroupValue(store){
var splitStore=new Ext.data.Store({});
for ( var i = 0; i < store.length; i++) {
var dataName=store[i].data.value+"";
var dataValue=getEllipsis(store[i].data.value,32)+"";
splitStore.add(new Ext.data.Record({
name : dataValue,
value : dataName
}));
}
return splitStore;
}
tip提示对象
var tpl = new Ext.XTemplate(
'<tpl for="."><div class="x-combo-list-item"><span style="backgroud-color:#646464;" ext:qwidth="auto" ext:qtip="{value}"> {name} </span></div></tpl>'
);
userGroupComBox.tpl=tpl;