-
當(dāng)前位置:首頁 > 創(chuàng)意學(xué)院 > 技術(shù) > 專題列表 > 正文
下拉多選框你了解易速達(dá)(易速達(dá)快遞)
大家好!今天讓創(chuàng)意嶺的小編來大家介紹下關(guān)于下拉多選框你了解易速達(dá)的問題,以下是小編對(duì)此問題的歸納整理,讓我們一起來看看吧。
開始之前先推薦一個(gè)非常厲害的Ai人工智能工具,一鍵生成原創(chuàng)文章、方案、文案、工作計(jì)劃、工作報(bào)告、論文、代碼、作文、做題和對(duì)話答疑等等
只需要輸入關(guān)鍵詞,就能返回你想要的內(nèi)容,越精準(zhǔn),寫出的就越詳細(xì),有微信小程序端、在線網(wǎng)頁版、PC客戶端
官網(wǎng):https://ai.de1919.com。
創(chuàng)意嶺作為行業(yè)內(nèi)優(yōu)秀的企業(yè),服務(wù)客戶遍布全球各地,如需了解SEO相關(guān)業(yè)務(wù)請(qǐng)撥打電話175-8598-2043,或添加微信:1454722008
本文目錄:
一、excel在一個(gè)單元格中實(shí)現(xiàn)下拉選項(xiàng)的子選項(xiàng),并且還可以多選,怎么實(shí)現(xiàn)啊?
可以采用二級(jí)下拉框(不能多選)實(shí)現(xiàn)。比如一級(jí)可選省份,二級(jí)可以按照一級(jí)的省份,選其下屬的市縣。具體方法:先定義名稱“省份”及其內(nèi)容,再定義以各省份名為名稱及其內(nèi)容(下屬市縣)。然后用數(shù)據(jù)有效性指定規(guī)則。二級(jí)數(shù)據(jù)有效性的數(shù)據(jù)來源填(假設(shè)一級(jí)下拉框在B列):=INDIRECT(B1)
二、Extjs怎么實(shí)現(xiàn)下拉框多選
1、擴(kuò)展js類庫,在項(xiàng)目中建立一個(gè) js文件,命名為:xxx.js 其代碼為
if ('function' !== typeof RegExp.escape){
RegExp.escape = function (s)
{
if ('string' !== typeof s)
{
return s;
}
return s.replace(/([.*+?^=!:${}()|[]/\])/g, '\$1');
};
}
Ext.ns('Ext.form');
Ext.form.MultiSelect = Ext.extend(Ext.form.ComboBox,
{
checkField: 'checked',
multi: true,
separator: ',',
initComponent: function ()
{
if (!this.tpl)
{
this.tpl = '<tpl for=".">' + '<div class="x-combo-list-item">'
+ '<img src="' + Ext.BLANK_IMAGE_URL + '" '
+ 'class="ux-MultiSelect-icon ux-MultiSelect-icon-'
+ '{[values.' + this.checkField + '?"checked":"unchecked"'
+ ']}">'
+ '{[values.' + this.displayField + ']}'
+ '</div>'
+ '</tpl>';
}
Ext.form.MultiSelect.superclass.initComponent.apply(this, arguments);
this.on(
{
scope: this,
beforequery: this.onBeforeQuery,
blur: this.onRealBlur
});
this.onLoad = this.onLoad.createSequence(function ()
{
if (this.el)
{
var v = this.el.dom.value;
this.el.dom.value = '';
this.el.dom.value = v;
}
});
},
initEvents: function ()
{
Ext.form.MultiSelect.superclass.initEvents.apply(this, arguments);
this.keyNav.tab = false;
},
beforeBlur: function ()
{
},
postBlur: function ()
{
},
clearValue: function ()
{
this.value = '';
this.setRawValue(this.value);
this.store.clearFilter();
this.store.each(function (r)
{
r.set(this.checkField, false);
}, this);
if (this.hiddenField)
{
this.hiddenField.value = '';
}
this.applyEmptyText();
},
getCheckedDisplay: function ()
{
var re = new RegExp(this.separator, "g");
return this.getCheckedValue(this.displayField).replace(re, this.separator + ' ');
},
getCheckedValue: function (field)
{
field = field || this.valueField;
var c = [];
var snapshot = this.store.snapshot || this.store.data;
snapshot.each(function (r)
{
if (r.get(this.checkField))
{
c.push(r.get(field));
}
}, this);
return c.join(this.separator);
},
onBeforeQuery: function (qe)
{
qe.query = qe.query.replace(new RegExp(RegExp.escape(this.getCheckedDisplay()) + '[ ' + this.separator + ']*'), '');
},
onRealBlur: function ()
{
this.list.hide();
var rv = this.getRawValue();
var rva = rv.split(new RegExp(RegExp.escape(this.separator) + ' *'));
var va = [];
var snapshot = this.store.snapshot || this.store.data;
Ext.each(rva, function (v)
{
snapshot.each(function (r)
{
if (v === r.get(this.displayField))
{
va.push(r.get(this.valueField));
}
}, this);
}, this);
this.setValue(va.join(this.separator));
this.store.clearFilter();
},
onSelect: function (record, index)
{
if (this.fireEvent('beforeselect', this, record, index) !== false)
{
record.set(this.checkField, !record.get(this.checkField));
if (this.store.isFiltered())
{
this.doQuery(this.allQuery);
}
if (this.multi)
{
if (record.get("key") == "---" && record.get(this.checkField))
{
this.setValue("---");
}
else
{
this.setValue(this.getCheckedValue());
}
}
else
{
this.clearValue();
this.value = record.get(this.valueField);
this.setRawValue(record.get(this.displayField));
this.list.hide();
}
this.fireEvent('select', this, record, index);
}
},
setValue: function (v)
{
if (v)
{
v = '' + v;
if (this.valueField)
{
this.store.clearFilter();
this.store.each(function (r)
{
var checked = !(!v.match('(^|' + this.separator + ')'
+ RegExp.escape(r.get(this.valueField))
+ '(' + this.separator + '|$)'));
r.set(this.checkField, checked);
}, this);
this.value = this.getCheckedValue();
this.setRawValue(this.getCheckedDisplay());
if (this.hiddenField)
{
this.hiddenField.value = this.value;
}
}
else
{
this.value = v;
this.setRawValue(v);
if (this.hiddenField)
{
this.hiddenField.value = v;
}
}
if (this.el)
{
this.el.removeClass(this.emptyClass);
}
}
else
{
this.clearValue();
}
},
selectAll: function ()
{
this.store.each(function (record)
{
record.set(this.checkField, true);
}, this);
this.doQuery(this.allQuery);
this.setValue(this.getCheckedValue());
},
deselectAll: function ()
{
this.clearValue();
}
});
Ext.reg('multiSelect', Ext.form.MultiSelect);
2、在ext-all.css文件最后,加入css樣式
.ux-MultiSelect-icon { width:16px; height:16px; float:left; background-position: -1px -1px ! important; background-repeat:no-repeat ! important; }.ux-MultiSelect-icon-checked { background: transparent url(../images/default/menu/checked.gif); }
.ux-MultiSelect-icon-unchecked { background: transparent url(../images/default/menu/unchecked.gif); }
3、使用
var DepartUserStore=new Ext.data.Store({
proxy: new Ext.data.HttpProxy(
{
url:'/Web/Manage/DeskTop/JSON/ScheduleManager/GetSimpleDepartUserInfo.aspx'
}),
//讀取Json
reader: new Ext.data.JsonReader(
{ totalProperty: "totalCount", root: "root" },
[
{name:'UserId',type:'int'},
{name:'UserName',type:'string'}
])
});
var DepartUserCbox = new Ext.form.MultiSelect(
{
fieldLabel: ' 姓名',
labelStyle: 'width:80px',
width: 150,
editable: false,
id: 'DepartUserDS',
hiddenName:'DepartUserIdDS',
store: DepartUserStore,
emptyText: '--請(qǐng)選擇--',
allowBlank: false,
blankText: '請(qǐng)選擇',
mode:'remote',
displayField: 'UserName',
valueField: 'UserId',
triggerAction: 'all',
selectOnFocus: true,
listWidth: 200
});
DepartUserStore.on('load', function ()
{
DepartUserCbox.selectAll(); //全選
});
DepartUserStore.load();
三、EXCEL 數(shù)據(jù)有效性下拉框,如何多選?謝謝,萬分感激
Private Sub Worksheet_Change(ByVal Target As Range)Dim rngDV As Range, oldVal As String, newVal As String
If Target.CountLarge > 1 Then GoTo exitHandler
On Error Resume Next
Set rngDV = Cells.SpecialCells(xlCellTypeAllValidation)
On Error GoTo exitHandler
If rngDV Is Nothing Then GoTo exitHandler
If Intersect(Target, rngDV) Is Nothing Then
'do nothing
Else
Application.EnableEvents = False
newVal = Target.Value
Application.Undo
oldVal = Target.Value
Target.Value = newVal
If Target.Column = 5 Or Target.Column = 7 Or Target.Column = 9 Or Target.Column = 11 Then '這里規(guī)定好哪一列的數(shù)據(jù)有效性是多選的,A列是第1列,依次類推,如3就是C列,7就是G列
If oldVal = "" Then
'do nothing
Else
If newVal = "" Then
'do nothing
Else
If newVal = "全選" Then '當(dāng)新選擇的值是全選時(shí),目標(biāo)值為全選
Target.Value = "全選"
Else
If InStr(1, oldVal, "全選") <> 0 Then '當(dāng)目標(biāo)值中有全選時(shí),選擇新的非全選值時(shí)為新的值
Target.Value = newVal
Else
If InStr(1, oldVal, newVal) <> 0 Then '重復(fù)選擇視同刪除
If InStr(1, oldVal, newVal) + Len(newVal) - 1 = Len(oldVal) Then '最后一個(gè)選項(xiàng)重復(fù)
Target.Value = Left(oldVal, Len(oldVal) - Len(newVal) - 1)
Else
Target.Value = Replace(oldVal, newVal & ",", "") '不是最后一個(gè)選項(xiàng)重復(fù)的時(shí)候處理逗號(hào)
End If
Else '不是重復(fù)選項(xiàng)就視同增加選項(xiàng)
Target.Value = oldVal & "," & newVal
End If
End If
End If
End If
End If
End If
End If
exitHandler:
Application.EnableEvents = True
End Sub
使用VBA代碼是可以實(shí)現(xiàn)復(fù)選的功能!
四、vb6中怎樣實(shí)現(xiàn)可多選的下拉框?(像是combobox和listbox的結(jié)合體)
VB6里面實(shí)現(xiàn)不了。只能做成一個(gè)一覽。可以利用部分功能滿足你的需求。listbox里面有個(gè)屬性Style。設(shè)置為1:CheckBox就可以了。
想做成你說的那樣的話,得自己自定義插件。
以上就是關(guān)于下拉多選框你了解易速達(dá)相關(guān)問題的回答。希望能幫到你,如有更多相關(guān)問題,您也可以聯(lián)系我們的客服進(jìn)行咨詢,客服也會(huì)為您講解更多精彩的知識(shí)和內(nèi)容。
推薦閱讀:
手機(jī)下拉為什么不顯示內(nèi)容(手機(jī)下拉為什么不顯示內(nèi)容了呢)
杭州電子科技大學(xué)控制工程怎么樣(杭州電子科技大學(xué)控制工程怎么樣知乎)