- 浏览: 2317612 次
- 性别:
- 来自: 北京
-
文章分类
- 全部博客 (314)
- JAVA基础知识 (54)
- Java-IO/FIle (16)
- Java-JDBC (4)
- JAVA-新增特性-注解 (3)
- Java-枚举 (2)
- Java-泛型 (1)
- Java-多线程 (15)
- Java-XML (4)
- Java-JMS(消息服务) (4)
- Java-JVM (0)
- Web Service服务 (7)
- Jsp (10)
- js (18)
- Struts框架 (11)
- Spring框架 (29)
- Hibernate框架 (28)
- Spring Boot框架 (2)
- ExtJS前端框架 (29)
- Jquery js库 (8)
- JUnit框架 (8)
- Selenium 测试 (1)
- NoSql---Redis (6)
- ORACLE数据库 (45)
- MySQL数据库 (4)
- tomcat (3)
- Nginx反向代理服务器 (4)
- web应用服务器通用知识 (3)
- 开发工具IDE (14)
- UML建模 (1)
- SVN CVS 版本管理 (6)
- git 分布式版本管理 (4)
- 报表设计 (5)
- 文件上传下载 (2)
- 数据算法 (1)
- 存储过程 (5)
- JSON 相关 (1)
- OGNL表达式 (3)
- Util工具包 (9)
- 设计模式 (15)
- linux 相关 (3)
- life think (3)
- 工作流管理框架 (1)
- 大数据-Hadoop (1)
最新评论
-
huih:
很不错的文章
SpringMVC+Hibernate+Spring 简单的一个整合实例 -
calm01:
学习了.
Spring <bean>标签属性 Autowire自动装配(转载) -
lizhenlzlz:
我的也是拦截不了service层
SpringAOP拦截Controller,Service实现日志管理(自定义注解的方式)(转载) -
josh_123:
讲的不错,很详细,如果quartz定时任务类采用不继承任何类的 ...
Spring,jdk定时任务的几种实现以及任务线程是串行还是并行执行(转载) -
human_coder:
你知道eclipse调试怎么可以回调吗?有时候总是调快了,不能 ...
Debug---Eclipse断点调试基础
下面介绍MultiComboBox的使用方式,大家先看看下面的代码:
Java代码
- Ext.onReady(function(){
- var formPanel = new Ext.FormPanel({
- height : 100,// 表单面板的高度
- width : 400,// 表单面板的宽度
- labelWidth : 120,// 字段标签宽度
- labelAlign : "right",// 字段标签对齐方式
- fileUpload: true,//支持文件上传
- defaults : {// 默认form元素类型为textfield
- xtype : "textfield",// 默认类型为textfield
- width : 150 // 默认宽度
- },
- items : [{
- xtype:'multicombo',
- width:250,
- store: new Ext.data.SimpleStore({
- fields: ["name","value"],
- data:[['测试菜单1',1],['测试菜单2',2],['测试菜单3',3],['测试菜单4',4]]}),
- valueField :"value",
- displayField: "name",
- labelSeparator:':',
- displaySeparator:';',
- valueSeparator:',',
- mode: 'local',
- value:'1,2',
- forceSelection: true,
- hiddenName:'test',
- editable: true,
- triggerAction: 'all',
- allowBlank:false,
- emptyText:'请选择',
- fieldLabel: '多选下拉ComBo'
- }],
- buttons : [{
- text : '提交',
- type : 'submit',
- handler : function() {
- }
- }]
- });
- formPanel.render("multicombo-div");
- });
- <span class="hilite1">Ext</span>
- .onReady(function(){
- var formPanel = new <span class="hilite1">Ext</span>
- .FormPanel({
- height : 100,// 表单面板的高度
- width : 400,// 表单面板的宽度
- labelWidth : 120,// 字段标签宽度
- labelAlign : "right",// 字段标签对齐方式
- fileUpload: true,//支持文件上传
- defaults : {// 默认form元素类型为textfield
- xtype : "textfield",// 默认类型为textfield
- width : 150 // 默认宽度
- },
- items : [{
- xtype:'multicombo',
- width:250,
- store: new <span class="hilite1">Ext</span>
- .data.SimpleStore({
- fields: ["name","value"],
- data:[['测试菜单1',1],['测试菜单2',2],['测试菜单3',3],['测试菜单4',4]]}),
- valueField :"value",
- displayField: "name",
- labelSeparator:':',
- displaySeparator:';',
- valueSeparator:',',
- mode: 'local',
- value:'1,2',
- forceSelection: true,
- hiddenName:'test',
- editable: true,
- triggerAction: 'all',
- allowBlank:false,
- emptyText:'请选择',
- fieldLabel: '多选下拉ComBo'
- }],
- buttons : [{
- text : '提交',
- type : 'submit',
- handler : function() {
- }
- }]
- });
- formPanel.render("multicombo-div");
- });
Ext
.onReady(function(){
var formPanel = new Ext
.FormPanel({
height : 100,// 表单面板的高度
width : 400,// 表单面板的宽度
labelWidth : 120,// 字段标签宽度
labelAlign : "right",// 字段标签对齐方式
fileUpload: true,//支持文件上传
defaults : {// 默认form元素类型为textfield
xtype : "textfield",// 默认类型为textfield
width : 150 // 默认宽度
},
items : [{
xtype:'multicombo',
width:250,
store: new Ext
.data.SimpleStore({
fields: ["name","value"],
data:[['测试菜单1',1],['测试菜单2',2],['测试菜单3',3],['测试菜单4',4]]}),
valueField :"value",
displayField: "name",
labelSeparator:':',
displaySeparator:';',
valueSeparator:',',
mode: 'local',
value:'1,2',
forceSelection: true,
hiddenName:'test',
editable: true,
triggerAction: 'all',
allowBlank:false,
emptyText:'请选择',
fieldLabel: '多选下拉ComBo'
}],
buttons : [{
text : '提交',
type : 'submit',
handler : function() {
}
}]
});
formPanel.render("multicombo-div");
});
由上面代码可以看到用法大致和ComboBox一样,不相同的地方是:
Java代码
- xtype:'multicombo',//MultiComboBox注册类型名称
- displaySeparator:';',//多选显示分隔字符
- valueSeparator:',',//多选提交到后台的值分隔符
- value:'1,2',// 多值通过","分隔,与valueSeparator相对应,表示默认选择了"测试菜单1'"和"测试菜单2"
- xtype:'multicombo',//MultiComboBox注册类型名称
- displaySeparator:';',//多选显示分隔字符
- valueSeparator:',',//多选提交到后台的值分隔符
- value:'1,2',// 多值通过","分隔,与valueSeparator相对应,表示默认选择了"测试菜单1'"和"测试菜单2"
xtype:'multicombo',//MultiComboBox注册类型名称
displaySeparator:';',//多选显示分隔字符
valueSeparator:',',//多选提交到后台的值分隔符
value:'1,2',// 多值通过","分隔,与valueSeparator相对应,表示默认选择了"测试菜单1'"和"测试菜单2"
由于添加了多选CheckBox图标,所以需要在ext-all.css文件最后添加两行支持样式:
Java代码
- .checked{background-image:url(../images/default/menu/checked.gif)}
- .unchecked{background-image:url(../images/default/menu/unchecked.gif)}
- .checked{background-image:url(../images/default/menu/checked.gif)}
- .unchecked{background-image:url(../images/default/menu/unchecked.gif)}
.checked{background-image:url(../images/default/menu/checked.gif)}
.unchecked{background-image:url(../images/default/menu/unchecked.gif)}
MultiComboBox的源代码:
Java代码
- Ext.form.MultiComboBox = Ext.extend(Ext.form.TriggerField, {
- defaultAutoCreate : {tag: "input", type: "text", size: "24", autocomplete: "off"},
- listClass: '',
- selectedClass: 'x-combo-selected',
- triggerClass : 'x-form-arrow-trigger',
- shadow:'sides',
- listAlign: 'tl-bl?',
- maxHeight: 300,
- triggerAction: 'query',
- minChars : 4,
- typeAhead: false,
- queryDelay: 500,
- pageSize: 0,
- selectOnFocus:false,
- queryParam: 'query',
- loadingText: 'Loading...',
- resizable: false,
- handleHeight : 8,
- editable: true,
- allQuery: '',
- mode: 'remote',
- minListWidth : 70,
- forceSelection:false,
- typeAheadDelay : 250,
- displaySeparator:';',
- valueSeparator:',',
- lazyInit : true,
- initComponent : function(){
- Ext.form.ComboBox.superclass.initComponent.call(this);
- this.addEvents(
- 'expand',
- 'collapse',
- 'beforeselect',
- 'select',
- 'beforequery'
- );
- if(this.transform){
- this.allowDomMove = false;
- var s = Ext.getDom(this.transform);
- if(!this.hiddenName){
- this.hiddenName = s.name;
- }
- if(!this.store){
- this.mode = 'local';
- var d = [], opts = s.options;
- for(var i = 0, len = opts.length;i < len; i++){
- var o = opts[i];
- var value = (Ext.isIE ? o.getAttributeNode('value').specified : o.hasAttribute('value')) ? o.value : o.text;
- if(o.selected) {
- this.value = value;
- }
- d.push([value, o.text]);
- }
- this.store = new Ext.data.SimpleStore({
- 'id': 0,
- fields: ['value', 'text'],
- data : d
- });
- this.valueField = 'value';
- this.displayField = 'text';
- }
- s.name = Ext.id(); // wipe out the name in case somewhere else they have a reference
- if(!this.lazyRender){
- this.target = true;
- this.el = Ext.DomHelper.insertBefore(s, this.autoCreate || this.defaultAutoCreate);
- Ext.removeNode(s); // remove it
- this.render(this.el.parentNode);
- }else{
- Ext.removeNode(s); // remove it
- }
- }
- this.selectedIndex = -1;
- if(this.mode == 'local'){
- if(this.initialConfig.queryDelay === undefined){
- this.queryDelay = 10;
- }
- if(this.initialConfig.minChars === undefined){
- this.minChars = 0;
- }
- }
- },
- // private
- onRender : function(ct, position){
- Ext.form.ComboBox.superclass.onRender.call(this, ct, position);
- var disValue="";
- if(this.hiddenName){
- this.hiddenField = this.el.insertSibling({tag:'input', type:'hidden', name: this.hiddenName, id: (this.hiddenId||this.hiddenName)},
- 'before', true);
- var hvalue=this.hiddenValue !== undefined ? this.hiddenValue :
- this.value !== undefined ? this.value : '';
- var hvalueArray=hvalue.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){
- disValue+=newValue+this.displaySeparator;
- }
- }
- }
- this.hiddenField.value =this.hiddenValue !== undefined ? this.hiddenValue :
- this.value !== undefined ? this.value : '';
- this.el.dom.removeAttribute('name');
- }
- if(Ext.isGecko){
- this.el.dom.setAttribute('autocomplete', 'off');
- }
- if(!this.lazyInit){
- this.initList();
- }else{
- this.on('focus', this.initList, this, {single: true});
- }
- if(!this.editable){
- this.editable = true;
- this.setEditable(false);
- }
- this.setValue(disValue);
- },
- initList : function(){
- if(!this.list){
- var cls = 'x-combo-list';
- this.list = new Ext.Layer({
- shadow: this.shadow, cls: [cls, this.listClass].join(' '), constrain:false
- });
- var lw = this.listWidth || Math.max(this.wrap.getWidth(), this.minListWidth);
- this.list.setWidth(lw);
- this.list.swallowEvent('mousewheel');
- this.assetHeight = 0;
- if(this.title){
- this.header = this.list.createChild({cls:cls+'-hd', html: this.title});
- this.assetHeight += this.header.getHeight();
- }
- this.innerList = this.list.createChild({cls:cls+'-inner'});
- this.innerList.on('mouseover', this.onViewOver, this);
- this.innerList.on('mousemove', this.onViewMove, this);
- this.innerList.setWidth(lw - this.list.getFrameWidth('lr'))
- if(this.pageSize){
- this.footer = this.list.createChild({cls:cls+'-ft'});
- this.pageTb = new Ext.PagingToolbar({
- store:this.store,
- pageSize: this.pageSize,
- renderTo:this.footer
- });
- this.assetHeight += this.footer.getHeight();
- }
- if(!this.tpl){
- //alert(cls);
- //x-combo-list-item
- this.tpl = '<tpl for="."><div class="'+cls+'-item"><span class="unchecked" id="checkBox_{' + this.displayField + '}"+ width="20"> </span>{' + this.displayField + '}</div></tpl>';
- }
- this.view = new Ext.DataView({
- applyTo: this.innerList,
- tpl: this.tpl,
- singleSelect: true,
- selectedClass: this.selectedClass,
- itemSelector: this.itemSelector || '.' + cls + '-item'
- });
- this.view.on('click', this.onViewClick, this);
- this.bindStore(this.store, true);
- if(this.resizable){
- this.resizer = new Ext.Resizable(this.list, {
- pinned:true, handles:'se'
- });
- this.resizer.on('resize', function(r, w, h){
- this.maxHeight = h-this.handleHeight-this.list.getFrameWidth('tb')-this.assetHeight;
- this.listWidth = w;
- this.innerList.setWidth(w - this.list.getFrameWidth('lr'));
- this.restrictHeight();
- }, this);
- this[this.pageSize?'footer':'innerList'].setStyle('margin-bottom', this.handleHeight+'px');
- }
- }
- },
- bindStore : function(store, initial){
- if(this.store && !initial){
- this.store.un('beforeload', this.onBeforeLoad, this);
- this.store.un('load', this.onLoad, this);
- this.store.un('loadexception', this.collapse, this);
- if(!store){
- this.store = null;
- if(this.view){
- this.view.setStore(null);
- }
- }
- }
- if(store){
- this.store = Ext.StoreMgr.lookup(store);
- this.store.on('beforeload', this.onBeforeLoad, this);
- this.store.on('load', this.onLoad, this);
- this.store.on('loadexception', this.collapse, this);
- if(this.view){
- this.view.setStore(store);
- }
- }
- },
- // private
- initEvents : function(){
- Ext.form.ComboBox.superclass.initEvents.call(this);
- this.keyNav = new Ext.KeyNav(this.el, {
- "up" : function(e){
- this.inKeyMode = true;
- this.selectPrev();
- },
- "down" : function(e){
- if(!this.isExpanded()){
- this.onTriggerClick();
- }else{
- this.inKeyMode = true;
- this.selectNext();
- }
- },
- "enter" : function(e){
- this.onViewClick();
- //return true;
- },
- "esc" : function(e){
- this.collapse();
- },
- "tab" : function(e){
- this.onViewClick(false);
- return true;
- },
- scope : this,
- doRelay : function(foo, bar, hname){
- if(hname == 'down' || this.scope.isExpanded()){
- return Ext.KeyNav.prototype.doRelay.apply(this, arguments);
- }
- return true;
- },
- forceKeyDown : true
- });
- this.queryDelay = Math.max(this.queryDelay || 10,
- this.mode == 'local' ? 10 : 250);
- this.dqTask = new Ext.util.DelayedTask(this.initQuery, this);
- if(this.typeAhead){
- this.taTask = new Ext.util.DelayedTask(this.onTypeAhead, this);
- }
- if(this.editable !== false){
- this.el.on("keyup", this.onKeyUp, this);
- }
- if(this.forceSelection){
- this.on('blur', this.doForce, this);
- }
- },
- onDestroy : function(){
- if(this.view){
- this.view.el.removeAllListeners();
- this.view.el.remove();
- this.view.purgeListeners();
- }
- if(this.list){
- this.list.destroy();
- }
- this.bindStore(null);
- Ext.form.ComboBox.superclass.onDestroy.call(this);
- },
- // private
- fireKey : function(e){
- if(e.isNavKeyPress() && !this.list.isVisible()){
- this.fireEvent("specialkey", this, e);
- }
- },
- // private
- onResize: function(w, h){
- Ext.form.ComboBox.superclass.onResize.apply(this, arguments);
- if(this.list && this.listWidth === undefined){
- var lw = Math.max(w, this.minListWidth);
- this.list.setWidth(lw);
- this.innerList.setWidth(lw - this.list.getFrameWidth('lr'));
- }
- },
- // private
- onDisable: function(){
- Ext.form.ComboBox.superclass.onDisable.apply(this, arguments);
- if(this.hiddenField){
- this.hiddenField.disabled = this.disabled;
- }
- },
- setEditable : function(value){
- if(value == this.editable){
- return;
- }
- this.editable = value;
- if(!value){
- this.el.dom.setAttribute('readOnly', true);
- this.el.on('mousedown', this.onTriggerClick, this);
- this.el.addClass('x-combo-noedit');
- }else{
- this.el.dom.setAttribute('readOnly', false);
- this.el.un('mousedown', this.onTriggerClick, this);
- this.el.removeClass('x-combo-noedit');
- }
- },
- // private
- onBeforeLoad : function(){
- if(!this.hasFocus){
- return;
- }
- this.innerList.update(this.loadingText ?
- '<div class="loading-indicator">'+this.loadingText+'</div>' : '');
- this.restrictHeight();
- this.selectedIndex = -1;
- },
- // private
- onLoad : function(){
- if(!this.hasFocus){
- return;
- }
- if(this.store.getCount() > 0){
- this.expand();
- this.restrictHeight();
- if(this.lastQuery == this.allQuery){
- if(this.editable){
- this.el.dom.select();
- }
- if(!this.selectByValue(this.value, true)){
- this.select(0, true);
- }
- }else{
- this.selectNext();
- if(this.typeAhead && this.lastKey != Ext.EventObject.BACKSPACE && this.lastKey != Ext.EventObject.DELETE){
- this.taTask.delay(this.typeAheadDelay);
- }
- }
- }else{
- this.onEmptyResults();
- }
- },
- // private
- onTypeAhead : function(){
- if(this.store.getCount() > 0){
- var r = this.store.getAt(0);
- var newValue = r.data[this.displayField];
- var len = newValue.length;
- var selStart = this.getRawValue().length;
- if(selStart != len){
- this.setRawValue(newValue);
- this.selectText(selStart, newValue.length);
- }
- }
- },
- // private
- onSelect : function(record, index){
- if(this.fireEvent('beforeselect', this, record, index) !== false){
- var r = this.store.getAt(index);
- var newValue = r.data[this.displayField];
- var check=document.getElementById("checkBox_"+newValue);
- if(check.className=="checked"){
- check.className="unchecked"
- }else{
- check.className="checked"
- }
- var value="";
- var hiddenValue="";
- for(var i=0;i<this.store.data.length;i++){
- var r = this.store.getAt(i);
- newValue = r.data[this.displayField];
- check=document.getElementById("checkBox_"+newValue);
- if(check.className=="checked"){
- value+= r.data[this.displayField]+this.displaySeparator;
- hiddenValue+= r.data[this.valueField]+this.valueSeparator;
- }
- }
- if(value.length>1){
- value=value.substring(0,value.length-this.displaySeparator.length);
- }
- if(hiddenValue.length>1){
- hiddenValue=hiddenValue.substring(0,value.length-this.valueSeparator.length);
- }
- this.setValue(value);
- this.hiddenField.value=hiddenValue;
- this.fireEvent('select', this, record, index);
- }
- },
- getValue : function(){
- if(this.valueField){
- return typeof this.value != 'undefined' ? this.value : '';
- }else{
- return Ext.form.ComboBox.superclass.getValue.call(this);
- }
- },
- /**
- * Clears any text/value currently set in the field
- */
- clearValue : function(){
- if(this.hiddenField){
- this.hiddenField.value = '';
- }
- this.setRawValue('');
- this.lastSelectionText = '';
- this.applyEmptyText();
- },
- setValue : function(v){
- var text = v;
- if(this.valueField){
- var r = this.findRecord(this.valueField, v);
- if(r){
- text = r.data[this.displayField];
- }else if(this.valueNotFoundText !== undefined){
- text = this.valueNotFoundText;
- }
- }
- this.lastSelectionText = text;
- Ext.form.ComboBox.superclass.setValue.call(this, text);
- this.value = v;
- },
- // private
- findRecord : function(prop, value){
- var record;
- if(this.store.getCount() > 0){
- this.store.each(function(r){
- if(r.data[prop] == value){
- record = r;
- return false;
- }
- });
- }
- return record;
- },
- // private
- onViewMove : function(e, t){
- this.inKeyMode = false;
- },
- // private
- onViewOver : function(e, t){
- if(this.inKeyMode){ // prevent key nav and mouse over conflicts
- return;
- }
- var item = this.view.findItemFromChild(t);
- if(item){
- var index = this.view.indexOf(item);
- this.select(index, false);
- }
- },
- // private
- onViewClick : function(doFocus){
- var index = this.view.getSelectedIndexes()[0];
- var r = this.store.getAt(index);
- if(r){
- this.onSelect(r, index);
- }
- if(doFocus !== false){
- this.el.focus();
- }
- },
- // private
- restrictHeight : function(){
- this.innerList.dom.style.height = '';
- var inner = this.innerList.dom;
- var fw = this.list.getFrameWidth('tb');
- var h = Math.max(inner.clientHeight, inner.offsetHeight, inner.scrollHeight);
- this.innerList.setHeight(h < this.maxHeight ? 'auto' : this.maxHeight);
- this.list.beginUpdate();
- this.list.setHeight(this.innerList.getHeight()+fw+(this.resizable?this.handleHeight:0)+this.assetHeight);
- this.list.alignTo(this.el, this.listAlign);
- this.list.endUpdate();
- },
- // private
- onEmptyResults : function(){
- this.collapse();
- },
- /**
- * Returns true if the dropdown list is expanded, else false.
- */
- isExpanded : function(){
- return this.list && this.list.isVisible();
- },
- selectByValue : function(v, scrollIntoView){
- if(v !== undefined && v !== null){
- var r = this.findRecord(this.valueField || this.displayField, v);
- if(r){
- this.select(this.store.indexOf(r), scrollIntoView);
- return true;
- }
- }
- return false;
- },
- select : function(index, scrollIntoView){
- this.selectedIndex = index;
- this.view.select(index);
- if(scrollIntoView !== false){
- var el = this.view.getNode(index);
- if(el){
- this.innerList.scrollChildIntoView(el, false);
- }
- }
- },
- // private
- selectNext : function(){
- var ct = this.store.getCount();
- if(ct > 0){
- if(this.selectedIndex == -1){
- this.select(0);
- }else if(this.selectedIndex < ct-1){
- this.select(this.selectedIndex+1);
- }
- }
- },
- // private
- selectPrev : function(){
- var ct = this.store.getCount();
- if(ct > 0){
- if(this.selectedIndex == -1){
- this.select(0);
- }else if(this.selectedIndex != 0){
- this.select(this.selectedIndex-1);
- }
- }
- },
- // private
- onKeyUp : function(e){
- if(this.editable !== false && !e.isSpecialKey()){
- this.lastKey = e.getKey();
- this.dqTask.delay(this.queryDelay);
- }
- },
- // private
- validateBlur : function(){
- return !this.list || !this.list.isVisible();
- },
- // private
- initQuery : function(){
- this.doQuery(this.getRawValue());
- },
- // private
- doForce : function(){
- if(this.el.dom.value.length > 0){
- this.el.dom.value =
- this.lastSelectionText === undefined ? '' : this.lastSelectionText;
- this.applyEmptyText();
- }
- },
- doQuery : function(q, forceAll){
- if(q === undefined || q === null){
- q = '';
- }
- var qe = {
- query: q,
- forceAll: forceAll,
- combo: this,
- cancel:false
- };
- if(this.fireEvent('beforequery', qe)===false || qe.cancel){
- return false;
- }
- q = qe.query;
- forceAll = qe.forceAll;
- if(forceAll === true || (q.length >= this.minChars)){
- if(this.lastQuery !== q){
- this.lastQuery = q;
- if(this.mode == 'local'){
- this.selectedIndex = -1;
- if(forceAll){
- this.store.clearFilter();
- }else{
- this.store.filter(this.displayField, q);
- }
- this.onLoad();
- }else{
- this.store.baseParams[this.queryParam] = q;
- this.store.load({
- params: this.getParams(q)
- });
- this.expand();
- }
- }else{
- this.selectedIndex = -1;
- this.onLoad();
- }
- }
- },
- // 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);
- },
- // private
- // Implements the default empty TriggerField.onTriggerClick function
- onTriggerClick : function(){
- if(this.disabled){
- return;
- }
- if(this.isExpanded()){
- this.collapse();
- this.el.focus();
- }else {
- this.onFocus({});
- if(this.triggerAction == 'all') {
- this.doQuery(this.allQuery, true);
- } else {
- this.doQuery(this.getRawValue());
- }
- this.el.focus();
- }
- }
- });
- Ext.reg('multicombo', Ext.form.MultiComboBox);
- <span class="hilite1">Ext</span>
- .form.MultiComboBox = <span class="hilite1">Ext</span>
- .extend(<span class="hilite1">Ext</span>
- .form.TriggerField, {
- defaultAutoCreate : {tag: "input", type: "text", size: "24", autocomplete: "off"},
- listClass: '',
- selectedClass: 'x-combo-selected',
- triggerClass : 'x-form-arrow-trigger',
- shadow:'sides',
- listAlign: 'tl-bl?',
- maxHeight: 300,
- triggerAction: 'query',
- minChars : 4,
- typeAhead: false,
- queryDelay: 500,
- pageSize: 0,
- selectOnFocus:false,
- queryParam: 'query',
- loadingText: 'Loading...',
- resizable: false,
- handleHeight : 8,
- editable: true,
- allQuery: '',
- mode: 'remote',
- minListWidth : 70,
- forceSelection:false,
- typeAheadDelay : 250,
- displaySeparator:';',
- valueSeparator:',',
- lazyInit : true,
- initComponent : function(){
- <span class="hilite1">Ext</span>
- .form.ComboBox.superclass.initComponent.call(this);
- this.addEvents(
- 'expand',
- 'collapse',
- 'beforeselect',
- 'select',
- 'beforequery'
- );
- if(this.transform){
- this.allowDomMove = false;
- var s = <span class="hilite1">Ext</span>
- .getDom(this.transform);
- if(!this.hiddenName){
- this.hiddenName = s.name;
- }
- if(!this.store){
- this.mode = 'local';
- var d = [], opts = s.options;
- for(var i = 0, len = opts.length;i < len; i++){
- var o = opts[i];
- var value = (<span class="hilite1">Ext</span>
- .isIE ? o.getAttributeNode('value').specified : o.hasAttribute('value')) ? o.value : o.text;
- if(o.selected) {
- this.value = value;
- }
- d.push([value, o.text]);
- }
- this.store = new <span class="hilite1">Ext</span>
- .data.SimpleStore({
- 'id': 0,
- fields: ['value', 'text'],
- data : d
- });
- this.valueField = 'value';
- this.displayField = 'text';
- }
- s.name = <span class="hilite1">Ext</span>
- .id(); // wipe out the name in case somewhere else they have a reference
- if(!this.lazyRender){
- this.target = true;
- this.el = <span class="hilite1">Ext</span>
- .DomHelper.insertBefore(s, this.autoCreate || this.defaultAutoCreate);
- <span class="hilite1">Ext</span>
- .removeNode(s); // remove it
- this.render(this.el.parentNode);
- }else{
- <span class="hilite1">Ext</span>
- .removeNode(s); // remove it
- }
- }
- this.selectedIndex = -1;
- if(this.mode == 'local'){
- if(this.initialConfig.queryDelay === undefined){
- this.queryDelay = 10;
- }
- if(this.initialConfig.minChars === undefined){
- this.minChars = 0;
- }
- }
- },
- // private
- onRender : function(ct, position){
- <span class="hilite1">Ext</span>
- .form.ComboBox.superclass.onRender.call(this, ct, position);
- var disValue="";
- if(this.hiddenName){
- this.hiddenField = this.el.insertSibling({tag:'input', type:'hidden', name: this.hiddenName, id: (this.hiddenId||this.hiddenName)},
- 'before', true);
- var hvalue=this.hiddenValue !== undefined ? this.hiddenValue :
- this.value !== undefined ? this.value : '';
- var hvalueArray=hvalue.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){
- disValue+=newValue+this.displaySeparator;
- }
- }
- }
- this.hiddenField.value =this.hiddenValue !== undefined ? this.hiddenValue :
- this.value !== undefined ? this.value : '';
- this.el.dom.removeAttribute('name');
- }
- if(<span class="hilite1">Ext</span>
- .isGecko){
- this.el.dom.setAttribute('autocomplete', 'off');
- }
- if(!this.lazyInit){
- this.initList();
- }else{
- this.on('focus', this.initList, this, {single: true});
- }
- if(!this.editable){
- this.editable = true;
- this.setEditable(false);
- }
- this.setValue(disValue);
- },
- initList : function(){
- if(!this.list){
- var cls = 'x-combo-list';
- this.list = new <span class="hilite1">Ext</span>
- .Layer({
- shadow: this.shadow, cls: [cls, this.listClass].join(' '), constrain:false
- });
- var lw = this.listWidth || Math.max(this.wrap.getWidth(), this.minListWidth);
- this.list.setWidth(lw);
- this.list.swallowEvent('mousewheel');
- this.assetHeight = 0;
- if(this.title){
- this.header = this.list.createChild({cls:cls+'-hd', html: this.title});
- this.assetHeight += this.header.getHeight();
- }
- this.innerList = this.list.createChild({cls:cls+'-inner'});
- this.innerList.on('mouseover', this.onViewOver, this);
- this.innerList.on('mousemove', this.onViewMove, this);
- this.innerList.setWidth(lw - this.list.getFrameWidth('lr'))
- if(this.pageSize){
- this.footer = this.list.createChild({cls:cls+'-ft'});
- this.pageTb = new <span class="hilite1">Ext</span>
- .PagingToolbar({
- store:this.store,
- pageSize: this.pageSize,
- renderTo:this.footer
- });
- this.assetHeight += this.footer.getHeight();
- }
- if(!this.tpl){
- //alert(cls);
- //x-combo-list-item
- this.tpl = '<tpl for="."><div class="'+cls+'-item"><span class="unchecked" id="checkBox_{' + this.displayField + '}"+ width="20"> </span>{' + this.displayField + '}</div></tpl>';
- }
- this.view = new <span class="hilite1">Ext</span>
- .DataView({
- applyTo: this.innerList,
- tpl: this.tpl,
- singleSelect: true,
- selectedClass: this.selectedClass,
- itemSelector: this.itemSelector || '.' + cls + '-item'
- });
- this.view.on('click', this.onViewClick, this);
- this.bindStore(this.store, true);
- if(this.resizable){
- this.resizer = new <span class="hilite1">Ext</span>
- .Resizable(this.list, {
- pinned:true, handles:'se'
- });
- this.resizer.on('resize', function(r, w, h){
- this.maxHeight = h-this.handleHeight-this.list.getFrameWidth('tb')-this.assetHeight;
- this.listWidth = w;
- this.innerList.setWidth(w - this.list.getFrameWidth('lr'));
- this.restrictHeight();
- }, this);
- this[this.pageSize?'footer':'innerList'].setStyle('margin-bottom', this.handleHeight+'px');
- }
- }
- },
- bindStore : function(store, initial){
- if(this.store && !initial){
- this.store.un('beforeload', this.onBeforeLoad, this);
- this.store.un('load', this.onLoad, this);
- this.store.un('loadexception', this.collapse, this);
- if(!store){
- this.store = null;
- if(this.view){
- this.view.setStore(null);
- }
- }
- }
- if(store){
- this.store = <span class="hilite1">Ext</span>
- .StoreMgr.lookup(store);
- this.store.on('beforeload', this.onBeforeLoad, this);
- this.store.on('load', this.onLoad, this);
- this.store.on('loadexception', this.collapse, this);
- if(this.view){
- this.view.setStore(store);
- }
- }
- },
- // private
- initEvents : function(){
- <span class="hilite1">Ext</span>
- .form.ComboBox.superclass.initEvents.call(this);
- this.keyNav = new <span class="hilite1">Ext</span>
- .KeyNav(this.el, {
- "up" : function(e){
- this.inKeyMode = true;
- this.selectPrev();
- },
- "down" : function(e){
- if(!this.isExpanded()){
- this.onTriggerClick();
- }else{
- this.inKeyMode = true;
- this.selectNext();
- }
- },
- "enter" : function(e){
- this.onViewClick();
- //return true;
- },
- "esc" : function(e){
- this.collapse();
- },
- "tab" : function(e){
- this.onViewClick(false);
- return true;
- },
- scope : this,
- doRelay : function(foo, bar, hname){
- if(hname == 'down' || this.scope.isExpanded()){
- return <span class="hilite1">Ext</span>
- .KeyNav.prototype.doRelay.apply(this, arguments);
- }
- return true;
- },
- forceKeyDown : true
- });
- this.queryDelay = Math.max(this.queryDelay || 10,
- this.mode == 'local' ? 10 : 250);
- this.dqTask = new <span class="hilite1">Ext</span>
- .util.DelayedTask(this.initQuery, this);
- if(this.typeAhead){
- this.taTask = new <span class="hilite1">Ext</span>
- .util.DelayedTask(this.onTypeAhead, this);
- }
- if(this.editable !== false){
- this.el.on("keyup", this.onKeyUp, this);
- }
- if(this.forceSelection){
- this.on('blur', this.doForce, this);
- }
- },
- onDestroy : function(){
- if(this.view){
- this.view.el.removeAllListeners();
- this.view.el.remove();
- this.view.purgeListeners();
- }
- if(this.list){
- this.list.destroy();
- }
- this.bindStore(null);
- <span class="hilite1">Ext</span>
- .form.ComboBox.superclass.onDestroy.call(this);
- },
- // private
- fireKey : function(e){
- if(e.isNavKeyPress() && !this.list.isVisible()){
- this.fireEvent("specialkey", this, e);
- }
- },
- // private
- onResize: function(w, h){
- <span class="hilite1">Ext</span>
- .form.ComboBox.superclass.onResize.apply(this, arguments);
- if(this.list && this.listWidth === undefined){
- var lw = Math.max(w, this.minListWidth);
- this.list.setWidth(lw);
- this.innerList.setWidth(lw - this.list.getFrameWidth('lr'));
- }
- },
- // private
- onDisable: function(){
- <span class="hilite1">Ext</span>
- .form.ComboBox.superclass.onDisable.apply(this, arguments);
- if(this.hiddenField){
- this.hiddenField.disabled = this.disabled;
- }
- },
- setEditable : function(value){
- if(value == this.editable){
- return;
- }
- this.editable = value;
- if(!value){
- this.el.dom.setAttribute('readOnly', true);
- this.el.on('mousedown', this.onTriggerClick, this);
- this.el.addClass('x-combo-noedit');
- }else{
- this.el.dom.setAttribute('readOnly', false);
- this.el.un('mousedown', this.onTriggerClick, this);
- this.el.removeClass('x-combo-noedit');
- }
- },
- // private
- onBeforeLoad : function(){
- if(!this.hasFocus){
- return;
- }
- this.innerList.update(this.loadingText ?
- '<div class="loading-indicator">'+this.loadingText+'</div>' : '');
- this.restrictHeight();
- this.selectedIndex = -1;
- },
- // private
- onLoad : function(){
- if(!this.hasFocus){
- return;
- }
- if(this.store.getCount() > 0){
- this.expand();
- this.restrictHeight();
- if(this.lastQuery == this.allQuery){
- if(this.editable){
- this.el.dom.select();
- }
- if(!this.selectByValue(this.value, true)){
- this.select(0, true);
- }
- }else{
- this.selectNext();
- if(this.typeAhead && this.lastKey != <span class="hilite1">Ext</span>
- .EventObject.BACKSPACE && this.lastKey != <span class="hilite1">Ext</span>
- .EventObject.DELETE){
- this.taTask.delay(this.typeAheadDelay);
- }
- }
- }else{
- this.onEmptyResults();
- }
- },
- // private
- onTypeAhead : function(){
- if(this.store.getCount() > 0){
- var r = this.store.getAt(0);
- var newValue = r.data[this.displayField];
- var len = newValue.length;
- var selStart = this.getRawValue().length;
- if(selStart != len){
- this.setRawValue(newValue);
- this.selectText(selStart, newValue.length);
- }
- }
- },
- // private
- onSelect : function(record, index){
- if(this.fireEvent('beforeselect', this, record, index) !== false){
- var r = this.store.getAt(index);
- var newValue = r.data[this.displayField];
- var check=document.getElementById("checkBox_"+newValue);
- if(check.className=="checked"){
- check.className="unchecked"
- }else{
- check.className="checked"
- }
- var value="";
- var hiddenValue="";
- for(var i=0;i<this.store.data.length;i++){
- var r = this.store.getAt(i);
- newValue = r.data[this.displayField];
- check=document.getElementById("checkBox_"+newValue);
- if(check.className=="checked"){
- value+= r.data[this.displayField]+this.displaySeparator;
- hiddenValue+= r.data[this.valueField]+this.valueSeparator;
- }
- }
- if(value.length>1){
- value=value.substring(0,value.length-this.displaySeparator.length);
- }
- if(hiddenValue.length>1){
- hiddenValue=hiddenValue.substring(0,value.length-this.valueSeparator.length);
- }
- this.setValue(value);
- this.hiddenField.value=hiddenValue;
- this.fireEvent('select', this, record, index);
- }
- },
- getValue : function(){
- if(this.valueField){
- return typeof this.value != 'undefined' ? this.value : '';
- }else{
- return <span class="hilite1">Ext</span>
- .form.ComboBox.superclass.getValue.call(this);
- }
- },
- /**
- * Clears any text/value currently set in the field
- */
- clearValue : function(){
- if(this.hiddenField){
- this.hiddenField.value = '';
- }
- this.setRawValue('');
- this.lastSelectionText = '';
- this.applyEmptyText();
- },
- setValue : function(v){
- var text = v;
- if(this.valueField){
- var r = this.findRecord(this.valueField, v);
- if(r){
- text = r.data[this.displayField];
- }else if(this.valueNotFoundText !== undefined){
- text = this.valueNotFoundText;
- }
- }
- this.lastSelectionText = text;
- <span class="hilite1">Ext</span>
- .form.ComboBox.superclass.setValue.call(this, text);
- this.value = v;
- },
- // private
- findRecord : function(prop, value){
- var record;
- if(this.store.getCount() > 0){
- this.store.each(function(r){
- if(r.data[prop] == value){
- record = r;
- return false;
- }
- });
- }
- return record;
- },
- // private
- onViewMove : function(e, t){
- this.inKeyMode = false;
- },
- // private
- onViewOver : function(e, t){
- if(this.inKeyMode){ // prevent key nav and mouse over conflicts
- return;
- }
- var item = this.view.findItemFromChild(t);
- if(item){
- var index = this.view.indexOf(item);
- this.select(index, false);
- }
- },
- // private
- onViewClick : function(doFocus){
- var index = this.view.getSelectedIndexes()[0];
- var r = this.store.getAt(index);
- if(r){
- this.onSelect(r, index);
- }
- if(doFocus !== false){
- this.el.focus();
- }
- },
- // private
- restrictHeight : function(){
- this.innerList.dom.style.height = '';
- var inner = this.innerList.dom;
- var fw = this.list.getFrameWidth('tb');
- var h = Math.max(inner.clientHeight, inner.offsetHeight, inner.scrollHeight);
- this.innerList.setHeight(h < this.maxHeight ? 'auto' : this.maxHeight);
- this.list.beginUpdate();
- this.list.setHeight(this.innerList.getHeight()+fw+(this.resizable?this.handleHeight:0)+this.assetHeight);
- this.list.alignTo(this.el, this.listAlign);
- this.list.endUpdate();
- },
- // private
- onEmptyResults : function(){
- this.collapse();
- },
- /**
- * Returns true if the dropdown list is expanded, else false.
- */
- isExpanded : function(){
- return this.list && this.list.isVisible();
- },
- selectByValue : function(v, scrollIntoView){
- if(v !== undefined && v !== null){
- var r = this.findRecord(this.valueField || this.displayField, v);
- if(r){
- this.select(this.store.indexOf(r), scrollIntoView);
- return true;
- }
- }
- return false;
- },
- select : function(index, scrollIntoView){
- this.selectedIndex = index;
- this.view.select(index);
- if(scrollIntoView !== false){
- var el = this.view.getNode(index);
- if(el){
- this.innerList.scrollChildIntoView(el, false);
- }
- }
- },
- // private
- selectNext : function(){
- var ct = this.store.getCount();
- if(ct > 0){
- if(this.selectedIndex == -1){
- this.select(0);
- }else if(this.selectedIndex < ct-1){
- this.select(this.selectedIndex+1);
- }
- }
- },
- // private
- selectPrev : function(){
- var ct = this.store.getCount();
- if(ct > 0){
- if(this.selectedIndex == -1){
- this.select(0);
- }else if(this.selectedIndex != 0){
- this.select(this.selectedIndex-1);
- }
- }
- },
- // private
- onKeyUp : function(e){
- if(this.editable !== false && !e.isSpecialKey()){
- this.lastKey = e.getKey();
- this.dqTask.delay(this.queryDelay);
- }
- },
- // private
- validateBlur : function(){
- return !this.list || !this.list.isVisible();
- },
- // private
- initQuery : function(){
- this.doQuery(this.getRawValue());
- },
- // private
- doForce : function(){
- if(this.el.dom.value.length > 0){
- this.el.dom.value =
- this.lastSelectionText === undefined ? '' : this.lastSelectionText;
- this.applyEmptyText();
- }
- },
- doQuery : function(q, forceAll){
- if(q === undefined || q === null){
- q = '';
- }
- var qe = {
- query: q,
- forceAll: forceAll,
- combo: this,
- cancel:false
- };
- if(this.fireEvent('beforequery', qe)===false || qe.cancel){
- return false;
- }
- q = qe.query;
- forceAll = qe.forceAll;
- if(forceAll === true || (q.length >= this.minChars)){
- if(this.lastQuery !== q){
- this.lastQuery = q;
- if(this.mode == 'local'){
- this.selectedIndex = -1;
- if(forceAll){
- this.store.clearFilter();
- }else{
- this.store.filter(this.displayField, q);
- }
- this.onLoad();
- }else{
- this.store.baseParams[this.queryParam] = q;
- this.store.load({
- params: this.getParams(q)
- });
- this.expand();
- }
- }else{
- this.selectedIndex = -1;
- this.onLoad();
- }
- }
- },
- // 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();
- <span class="hilite1">Ext</span>
- .getDoc().un('mousewheel', this.collapseIf, this);
- <span class="hilite1">Ext</span>
- .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();
- <span class="hilite1">Ext</span>
- .getDoc().on('mousewheel', this.collapseIf, this);
- <span class="hilite1">Ext</span>
- .getDoc().on('mousedown', this.collapseIf, this);
- this.fireEvent('expand', this);
- },
- // private
- // Implements the default empty TriggerField.onTriggerClick function
- onTriggerClick : function(){
- if(this.disabled){
- return;
- }
- if(this.isExpanded()){
- this.collapse();
- this.el.focus();
- }else {
- this.onFocus({});
- if(this.triggerAction == 'all') {
- this.doQuery(this.allQuery, true);
- } else {
- this.doQuery(this.getRawValue());
- }
- this.el.focus();
- }
- }
- });
- <span class="hilite1">Ext</span>
- .reg('multicombo', <span class="hilite1">Ext</span>
- .form.MultiComboBox);
ext-all.css文件最后添加两行支持样式:
1.checked{background-image:url(../images/default/menu/checked.gif)}
2.unchecked{background-image:url(../images/default/menu/unchecked.gif)}
发表评论
-
EXT弹出窗口(转载)
2015-02-26 16:56 3183Ext.MessageBox.alert() Ext.Me ... -
Extjs教程_第六章_Editor_Grids(可编辑表格) (转载)
2015-02-15 16:04 6270在之前的一章中我 ... -
extJs 2.1学习笔记(Ext.Updater篇二) (转载)
2015-02-15 15:13 1320原文地址:http://blog.csdn.net/huo ... -
三大主流浏览器Web开发工具(转载)
2015-02-03 14:55 2806一个快速加载网页在很大程度上节约用户的浏览页面时间成本,作 ... -
ext+struts2排除List泛型中不想封装的属性(转载)
2015-02-02 18:10 1445struts2封装json,排除不想封装的字段配置,减少网 ... -
Ext Store Filter的实现和问题(转)
2014-01-26 14:33 6639Store包含两个数据缓存 - snapshot和data ... -
ExtJs之Ext.data.Store详解(转载)
2014-01-26 10:31 61961Ext.data.Store是EXT中用来进行数据交换和数据 ... -
Ext Grid表格导出excel
2013-08-22 16:10 4600两种方法,这是一种 ... -
ext中屏蔽backsapce删除时退出的代码
2012-07-31 11:37 1603<script type="text/java ... -
Ext 布局的一些配置属性
2012-07-10 16:48 1552布局配置中,layout和itmes是常用的,通过layout ... -
Ext CardLayout,AnchorLayout,AbsoulteLayout,FormLayout,ColumnLayout,TableLayout
2012-07-10 16:29 19121,CardLayout可以看做一叠卡片,是实现操作向导的典型 ... -
Ext AccordionLayout 布局
2012-07-10 15:58 1515Accordion布局类似于QQ中的伸缩菜单,通过点击可以折叠 ... -
Ext BorderLayout 布局
2012-07-10 11:59 2054BorderLayout布局比fit布局 ... -
Ext FitLayout 布局
2012-07-10 11:37 1249fit布局将使得组件自适应,子面板自动填充整个组件所占范围,不 ... -
Extjs的布局--学习(有例子)(转载)
2012-07-03 17:39 6339所谓布局就是指容器组件中子元素的分布、排列组合方式。Ext的所 ... -
Ext.query()和Ext.get()的区别,Ext.query()类似于jquery的DOM选择器
2012-07-03 17:02 2688Ext.get() 和 Ext.query() 取 ... -
Ext组件ComboBox 中getValue()和getRawValue()的区别
2012-06-29 10:04 6791当把Ext.form.ComboBox 的editable 设 ... -
ExtJs页面布局详解
2012-06-20 16:29 6460EXT标准布局类 面板相当于一张干净的白纸,如果直接在上 ... -
Extjs xtype 一览表
2012-02-09 16:10 24027ExtJs xtype一览 基本组件: ... -
Ext中的get、getDom、getCmp、getBody、getDoc的区别 (转)
2012-02-02 16:28 1783Ext 中包含了几个以 get 开头的方法,这些方法 ...
相关推荐
通过深入学习EXTJS的"ext下拉多选组件multicombo",开发者可以掌握如何在自己的应用中实现多选下拉功能,提升用户体验。同时,对源码的研究有助于增强EXTJS框架的理解,从而更好地进行组件的扩展和定制,满足特定...
最后,`multiCombox` 文件名可能指的是一个包含实现多选下拉框功能的代码或示例的文件。如果你有这个文件,可以参考其中的内容,结合上述讲解来理解和学习多选ComboBox的实现。在实践中,不断探索和调试,你将更熟练...
内容概要:本文详细介绍了低成本单发单收激光测距传感器的一站式解决方案,涵盖硬件设计、软件实现及其应用。硬件部分基于STM32F030F4P6芯片,搭配激光发射管和APD接收模块,通过精心设计的信号调理电路确保高精度测量。软件部分展示了关键代码片段,如初始化、测距算法和ADC配置,采用改进型飞行时间法(ToF)并通过DMA优化数据处理效率。此外,文章还讨论了调试过程中遇到的问题及解决方案,如环境光干扰和PCB布局优化。最终,该方案实现了0.05-50米范围内±1.5mm的测距精度,适用于多种应用场景。 适合人群:电子爱好者、硬件工程师、嵌入式系统开发者。 使用场景及目标:① DIY爱好者可以通过本方案进行个人项目的开发;② 企业可以基于此方案进行商业产品的开发,降低成本;③ 教育机构可以用作教学案例,帮助学生理解激光测距原理和技术实现。 其他说明:文章不仅提供详细的硬件和软件设计方案,还包括BOM清单、供应商信息和调试指南,有助于快速实现和优化项目。
内容概要:本文详细介绍了将麻雀算法(SSA)应用于LSTM参数优化的方法及其MATLAB实现。首先,通过生成带噪声的正弦波数据模拟真实场景的数据扰动,然后定义适应度函数用于评估LSTM模型的表现。接着,利用麻雀算法的发现者和跟随者角色进行参数优化,最终实现了比随机调参更好的预测效果。文中不仅提供了完整的代码实现,还讨论了参数设置的经验值以及一些实用技巧,如数据归一化、早停机制和并行加速等。 适合人群:对机器学习尤其是深度学习有一定了解的研究人员和技术爱好者,熟悉MATLAB编程环境。 使用场景及目标:适用于需要提高时间序列预测精度的任务,如金融数据分析、天气预报等领域。主要目标是通过引入生物启发式的优化算法来提升LSTM模型的性能。 其他说明:文中提到的麻雀算法能够显著减少人工调参的工作量,并且相比传统的网格搜索法更加高效。此外,作者还分享了一些实践经验,帮助读者更好地理解和应用这一方法。
内容概要:本文详细介绍了使用西门子Smart200 PLC实现高效的星三角降压启动子程序的方法。作者分享了具体的编程技巧,包括参数化的外部配置、定时器的巧妙运用以及故障处理机制。文中展示了完整的主程序调用示例和子程序内部逻辑,强调了模块化编程的优势,使得不同电机可以轻松复用相同的子程序,极大提高了调试和维护效率。此外,作者还提到了一些常见的调试陷阱和优化建议,如避免星三角同时导通、合理设置切换时间和加入硬件互锁等。 适合人群:从事PLC编程、自动化控制领域的工程师和技术人员,尤其是那些希望提高编程效率和代码复用性的从业者。 使用场景及目标:适用于需要频繁进行电机星三角降压启动的工业应用场景,如纺织厂、水泥厂等。主要目标是通过模块化编程减少重复劳动,提升系统稳定性和响应速度。 其他说明:文章不仅提供了详细的代码示例,还分享了许多实践经验,帮助读者更好地理解和应用这些技术。
2025中国数字营销趋势报告.pdf
内容概要:本文详细介绍了如何利用两台威纶通MT6071iP触摸屏控制一台信捷PLC的具体步骤和技术要点。主要内容涵盖硬件连接、触摸屏设置、PLC编程、调试与优化等方面。文中不仅提供了具体的配置方法,如通讯参数设置、画面设计、宏指令处理等,还分享了许多实际操作中的经验和注意事项,如地址分配、数据同步、通讯稳定性提升等。 适合人群:从事工业自动化领域的工程师和技术人员,尤其是那些需要实现多屏协同控制PLC系统的工作者。 使用场景及目标:适用于需要提高生产线上设备操作便捷性和监控灵活性的场合。通过一机多屏设置,可以在不同位置对同一PLC进行控制,方便现场操作和远程管理。 其他说明:文章强调了硬件连接细节、通讯参数一致性、PLC编程逻辑的重要性,并提供了一些实用技巧,如宏指令处理、心跳检测、防呆设计等,帮助读者更好地理解和实施该项目。
2024中国上市公司数字化转型报告.pdf
内容概要:《2024年中国物联网产业创新白皮书》由深圳市物联网产业协会与AIoT星图研究院联合编制,汇集了全国30多个省市物联网组织的智慧。白皮书系统梳理了中国物联网产业的发展历程、现状及未来趋势,涵盖了物联网的概念、产业结构、市场规模、投融资情况、面临的问题与机遇。书中详细分析了感知层、传输层、平台层及应用层的关键技术,探讨了智慧城市、智能工业、车联网、智慧医疗等九大产业物联网应用领域,以及消费物联网的发展特征与热门单品。此外,白皮书还关注了物联网数据安全、法规遵从、人才短缺等挑战,并提出了相应的解决方案。 适用人群:物联网从业者、企业决策者、政策制定者及相关研究机构。 使用场景及目标:①帮助从业者深入了解物联网产业的现状和发展趋势;②为企业决策者提供战略规划依据;③为政策制定者提供政策支持和法规制定参考;④为研究机构提供详尽的数据和案例支持。 其他说明:白皮书不仅限于技术科普,更从宏观角度结合市场情况,多维度讨论了物联网产业生态,旨在为物联网企业、从业者找到最适合的技术应用场景,促进产业健康发展。报告还特别鸣谢了参与市场调研的企业,感谢他们提供的宝贵行业信息。由于时间和资源的限制,报告可能存在信息不充分之处,欢迎各界人士提出宝贵意见。
内容概要:本文详细介绍了汇川H5U PLC中采用结构体编程的优势及其具体应用场景。作者通过多个实际项目案例展示了结构体编程如何显著提高代码的整洁度、可维护性和扩展性。文中特别强调了结构体在处理大量相似设备(如气缸、阀门、伺服轴)时的作用,以及如何利用结构体简化变量管理、增强在线调试体验并减少内存消耗。此外,还讨论了一些常见的注意事项和技术细节,如结构体初始化、功能块集成、在线修改功能的应用等。 适用人群:从事工业自动化系统开发的技术人员,尤其是对PLC编程有一定经验的工程师。 使用场景及目标:适用于需要高效管理和维护复杂工业控制系统的场合,旨在帮助工程师更好地理解和掌握结构体编程技巧,从而提高工作效率和代码质量。 其他说明:文章提供了丰富的代码片段作为示例,便于读者直观地理解结构体编程的具体实现方法。同时提醒读者注意结构体初始化等问题,确保项目顺利进行。
内容概要:本文介绍了如何利用数学建模替代传统的电气元件仿真,实现三相逆变器的模型预测控制(MPC)。主要内容包括三相桥的数学模型建立、代价函数设计、状态方程离散化以及仿真优化技巧。通过将三相桥的输出电压转换为矩阵运算,减少了计算复杂度,提高了仿真速度。代价函数不仅考虑了电流跟踪误差,还加入了开关频率惩罚项,以减少不必要的开关动作。此外,文中提供了详细的代码示例,展示了如何通过数学建模实现高效的MPC控制。 适合人群:从事电力电子控制系统设计的研究人员和技术人员,尤其是对三相逆变器及其控制算法感兴趣的读者。 使用场景及目标:适用于需要快速迭代和验证控制算法的场合,如光伏并网、电机驱动等领域。目标是提高仿真效率,优化控制性能,减少开发时间和成本。 其他说明:文中提到的技术手段能够显著提升仿真速度,但在应用时需要注意数值稳定性和参数辨识的准确性。
内容概要:本文详细介绍了如何使用MATLAB/Simulink构建并仿真一个60W的Flyback变换器模型,输入为390V直流,输出为19V/3A。主要内容涵盖主电路搭建(包括变压器参数设置、MOSFET选择)、吸收电路设计(RCD参数调整)、闭环控制系统(PID参数调节)以及动态性能测试。文中还提供了多个实用技巧,如防止变压器饱和、优化吸收电路参数、提高动态响应速度等,并指出了常见的错误及其解决方案。同时,推荐了几本相关领域的经典书籍供进一步学习。 适合人群:初学者和有一定基础的电源设计师,特别是希望深入了解Flyback变换器工作原理和技术细节的人群。 使用场景及目标:适用于需要进行中小功率电源设计的研究人员和工程师,旨在帮助他们掌握Flyback变换器的设计方法,提升仿真的准确性和可靠性。 其他说明:提供的仿真文件可以在MATLAB 2017b及以上版本运行,建议读者按照文中步骤逐步实践,以便更好地理解和应用所学知识。
内容概要:《2024年中国城市低空经济发展指数报告》由36氪研究院发布,指出低空经济作为新质生产力的代表,已成为中国经济新的增长点。报告从发展环境、资金投入、创新能力、基础支撑和发展成效五个维度构建了综合指数评价体系,评估了全国重点城市的低空经济发展状况。北京和深圳在总指数中名列前茅,分别以91.26和84.53的得分领先,展现出强大的资金投入、创新能力和基础支撑。低空经济主要涉及无人机、eVTOL(电动垂直起降飞行器)和直升机等产品,广泛应用于农业、物流、交通、应急救援等领域。政策支持、市场需求和技术进步共同推动了低空经济的快速发展,预计到2026年市场规模将突破万亿元。 适用人群:对低空经济发展感兴趣的政策制定者、投资者、企业和研究人员。 使用场景及目标:①了解低空经济的定义、分类和发展驱动力;②掌握低空经济的主要应用场景和市场规模预测;③评估各城市在低空经济发展中的表现和潜力;④为政策制定、投资决策和企业发展提供参考依据。 其他说明:报告强调了政策监管、产业生态建设和区域融合错位的重要性,提出了加强法律法规建设、人才储备和基础设施建设等建议。低空经济正加速向网络化、智能化、规模化和集聚化方向发展,各地应找准自身比较优势,实现差异化发展。
内容概要:本文深入探讨了汇川H5U PLC程序框架,尤其是其在ETHERCAT总线控制方面的应用。该框架提供了完整的气缸控制、轴控制等功能模块,涵盖从初始化到故障处理的全过程。文中详细介绍了气缸控制的梯形图逻辑、轴控制的具体指令及其状态机设计,并展示了触摸屏与PLC变量的绑定方法。此外,还提到了三套针对不同应用场景的程序样例,包括单机设备、流水线联动和柔性生产版本。整体而言,该框架以其条理分明的代码结构和丰富的功能模块,成为自动化控制领域的有力工具。 适合人群:从事工业自动化控制系统的工程师和技术人员,特别是初学者和希望深入了解汇川H5U PLC及ETHERCAT总线控制的专业人士。 使用场景及目标:适用于需要高效、稳定的多轴运动控制和人机交互的自动化项目。主要目标是帮助用户快速掌握汇川H5U PLC的编程技巧,提高项目的开发效率和可靠性。 其他说明:文章强调了框架的实用性、易用性和详细的文档支持,使得即使是新手也能轻松上手并应用于实际项目中。
https://blog.csdn.net/qianqianaao/article/details/147515496?fromshare=blogdetail&sharetype=blogdetail&sharerId=147515496&sharerefer=PC&sharesource=qianqianaao&sharefrom=from_link python小项目
内容概要:本文详细介绍了如何利用Cruise和Simulink平台进行增程式混合动力汽车的整车仿真模型构建。主要内容涵盖增程器、电池、驱动电机等关键部件的物理参数设置,尤其是发电机和驱动电机效率MAP图的精确调整。文中强调了控制策略的重要性,将其分为驾驶模式选择、扭矩分配、SOC平衡三个子系统,并讨论了模式切换逻辑、再生制动策略以及DLL联合仿真的难点和技术细节。此外,作者分享了许多实用的经验和技巧,如使用二维插值提高增程器工作效率、设置合理的滞回区避免模式震荡、通过环形缓冲区解决时钟同步问题等。 适合人群:从事新能源汽车研究的技术人员、高校相关专业师生、对混合动力汽车仿真感兴趣的工程师。 使用场景及目标:帮助读者掌握增程式混合动力汽车仿真模型的搭建方法,提高仿真的准确性,优化控制策略,减少开发周期和成本。 其他说明:文章提供了大量实战经验和调试技巧,有助于解决实际工作中常见的问题,如模式切换不稳定、DLL编译错误、制动能量回收不合理等。同时,还分享了一些提高仿真效率的小窍门,如使用Fast Restart功能、避免内存泄漏等。
内容概要:本文详细介绍了威纶通触摸屏上利用EBpro软件和宏指令实现的经典贪吃蛇游戏。文中不仅剖析了游戏的核心逻辑,如蛇的移动、碰撞检测、方向控制以及食物生成算法,还探讨了宏指令在触摸屏编程中的具体应用。通过这个模板,读者可以深入了解宏指令的工作机制及其在工业触摸屏编程中的优势。 适合人群:对嵌入式系统、人机界面(HMI)编程感兴趣的开发者和技术爱好者。 使用场景及目标:① 学习如何在威纶通触摸屏上使用宏指令进行编程;② 掌握贪吃蛇游戏的基本逻辑和实现方法;③ 提升对工业触摸屏编程的理解,尤其是宏指令的应用技巧。 其他说明:文章提供了详细的代码片段和注释,帮助读者更好地理解和修改代码。同时,文中提到的一些优化建议(如防止180度急转弯、改进随机数生成等)有助于提高游戏性能和用户体验。
内容概要:本文详细介绍了如何利用黏菌优化算法(SMA)优化广义回归神经网络(GRNN)来进行时间序列的拟合预测建模。首先解释了SMA和GRNN的基本原理,接着提供了完整的MATLAB代码实现,包括数据加载与划分、SMA参数设置、SMA主循环、模型构建与预测、绘图与指标计算等步骤。文中不仅给出了详细的代码注释,还分享了一些实用的经验技巧,如数据处理方法、参数选择建议等。此外,通过具体的案例展示了该方法的有效性和优越性。 适合人群:对时间序列预测感兴趣的科研人员、学生以及有一定编程基础的数据分析师。 使用场景及目标:适用于需要高精度时间序列预测的应用场景,如金融、能源等领域。主要目标是提高预测精度,减少预测误差,提供可靠的预测结果。 其他说明:本文提供的代码可以直接应用于实际项目中,只需替换相应数据即可。同时,文中提到的一些经验和技巧可以帮助使用者更好地理解和应用该方法。
本书是《Data Structures and Algorithm Analysis in C++》第三版的解答手册,包含了该教科书中许多练习题的答案。这些答案反映了第三版第一次印刷时书籍的状态。特别排除了一般编程问题和任何解决方案在章节末尾有参考文献的问题。解决方案在完整性程度上有所不同;通常,细节留给读者。存在的少量代码段落应该是伪-C++代码,而不是完全完美的代码。本书适合已经学习过《Data Structures and Algorithm Analysis in C++》的学生或读者使用,作为理解和掌握数据结构与算法分析的辅助材料。
网络安全_masscan_报告转换_xls格式分析用途_1745569541.zip