带复选框且支持搜索功能的下拉列表13

本文介绍了一种实现下拉列表展开与隐藏的方法,包括显示与隐藏列表、响应鼠标滚轮及点击事件等关键功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


// private
getParams : function(q)
{
var p = {};
//p[this.queryParam] = q;
if (this.pageSize)
{
p.start = 0;
p.limit = this.pageSize;
}
return p;
},
/**
* Hides the dropdown list if it is currently expanded. Fires the 'collapse' event on completion.
*/
collapse : function()
{
if (!this.isExpanded())
{
return;
}
this.list.hide();
Ext.getDoc().un('mousewheel', this.collapseIf, this);
Ext.getDoc().un('mousedown', this.collapseIf, this);
this.fireEvent('collapse', this);
},
// private
collapseIf : function(e)
{
if (!e.within(this.wrap) && !e.within(this.list))
{
this.collapse();
}
},

/**
* Expands the dropdown list if it is currently hidden. Fires the 'expand' event on completion.
*/
expand : function()
{
if (this.isExpanded() || !this.hasFocus)
{
return;
}
this.list.alignTo(this.wrap, this.listAlign);
var hvalueArray = this.hiddenField.value.split(this.valueSeparator);
for (var i = 0; i < this.store.data.length; i++)
{
var r = this.store.getAt(i);
var newValue = r.data[this.displayField];
var v = r.data[this.valueField];
for (var j = 0; j < hvalueArray.length; j++)
{
if (hvalueArray[j] == v)
{
document.getElementById("checkBox_" + newValue).className = "checked";
}
}

}
this.list.show();
Ext.getDoc().on('mousewheel', this.collapseIf, this);
Ext.getDoc().on('mousedown', this.collapseIf, this);
this.fireEvent('expand', this);
},
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值