/**
* 下拉ComboBoxGrid
*
* @xtype 'combogrid'
* @author chengbao_zhu
*/
ComboBoxGrid = Ext.extend(Ext.form.ComboBox, {
gridHeight : 180,
listAlign : 'tr-br',
listWidth : 300,
store : new Ext.data.SimpleStore({
fields : [],
data : [[]]
}),
resizable : false,
// Default
editable : false,
mode : 'local',
triggerAction : 'all',
maxHeight : 500,
selectedClass : '',
onSelect : Ext.emptyFn,
emptyText : '\u8bf7\u9009\u62e9...',
/**
* ----------------------------------
* 单击GRID事件
* ----------------------------------
*/
gridClk : function(grid, rowIndex, e) {
this.setRawValue(grid.getRecord(rowIndex).data[this.displayField]);
this.setValue(grid.getRecord(rowIndex).data[this.valueField]);
this.collapse();
this.fireEvent('gridselected', grid.getRecord(rowIndex));
},
initLayout : function(){
this.grid.autoScroll = true;
this.grid.height = this.gridHeight;
this.grid.containerScroll = false;
this.grid.border=false;
this.listWidth = this.grid.width+3;
},
/**
* Init
*/
initComponent : function() {
ComboBoxGrid.superclass.initComponent.call(this);
this.initLayout();
this.tplId = Ext.id();
// overflow:auto"
this.tpl = '<div id="' + this.tplId + '" style="height:' + this.gridHeight
+ ';overflow:hidden;"></div>';
//Add Event
this.addEvents('gridselected');
},
/**
* ------------------
* Listener
* ------------------
*/
listeners : {
'expand' : {
fn : function() {
if (!this.grid.rendered && this.tplId) {
//this.initComponent();
this.initLayout();
this.grid.render(this.tplId);
this.store = this.grid.store;
this.store.reload();
if(this.store.getCount()==0){
this.store.add(new Ext.data.Record([{}]));
}
//this.grid.store.reload();
this.grid.on('rowclick', this.gridClk, this);
}
this.grid.show();
}
//single : true
},
'render' : {
fn : function() {
}
},
'beforedestroy' : {
fn : function(cmp) {
this.purgeListeners();
this.grid.purgeListeners();
}
},
'collapse' : {
fn : function(cmp) {
/**
* 防止当store的记录为0时不出现下拉的状况
*/
if(this.grid.store.getCount()==0){
this.store.add(new Ext.data.Record([{}]));
}
}
}
}
});
/**
* ---------------------------------
* register:'combotree'
* ---------------------------------
*/
Ext.reg('combogrid', ComboBoxGrid);
分享到:
相关推荐
ComboBox下拉框内字体加颜色 在COMBOBOX内重画得到的字体加颜色
DataGridView控件中加入ComboBox下拉列表框
delphi7实现 combobox下拉hint
改变ComboBox下拉高度/强行展开下拉表/自动查询列表/多列下拉框/XP风格Combobox/带图标的ComboBox 多个与ComboBox相关的源码工程下载
vs2008演示演示ComboBox下拉列表控件的使用实例
继承自C# Winform中ComboBox的下拉多选控件,操作简单,效果非常好 1、多选。 2、可绑定List,DataTable,Dictionary类型的数据源。 3、在下拉列表中可显示自定义的多列数据。 4、可在下拉列表中通过输入关键字,...
使用Blend 对ComboBox控件进行模板样式重写
开发工具:VS2010 语言:C# 功能:ComboBox下拉颜色条
对WPF的ComboBox进行了扩展,现在可以在下拉列表中嵌入DataGrid/ListView/ListBox等数据控件,实现了展开后列表的自动选择,自动滚屏,并完全支持数据的绑定操作
C#DataGridView单元格中ComboBox下拉更改事件
在COMBOBOX下拉框中显示图片。
delphi 控件开发 eidt,combobox下拉tree,自动级联查询parent
Extjs4下拉菜单中用Grid显示,有单选,和多选两个控件,完美通用代码控件,绝对让你好用,值得收藏^-^
在DataGridView控件中加入ComboBox下拉列表框的实现
combobox下拉时间选择控件,附源码
一款非常实用的C# 的combobox的第三方控件,可以实现下拉后在下拉框中添加图片的功能,忘对有此功能需求的朋友所有帮助。
C#中实现combobox的自动完成功能
NULL 博文链接:https://dengli19881102.iteye.com/blog/1046190
改变combobox的下拉高度
在WPF下,对ComboBox进行了扩展,可以很方便的在下拉列表框中嵌入DataGrid/ListView/ListBox,并实现数据的绑定