- 浏览: 451741 次
- 性别:
- 来自: 广州
文章分类
最新评论
-
ubuntu的疯狂:
推荐一份完整的教程:http://blog.ddlisting ...
Emberjs学习 -
ptz19:
请问,如果把合并前的文件,不要dest 目标目录来。如: js ...
gulp下静态资源的合并、压缩、MD5后缀 -
zhouzq1008:
楼主,还有个问题,<a href="" ...
gulp下静态资源的合并、压缩、MD5后缀 -
zhouzq1008:
感谢楼主,用到了您的代码, 但现在好像有改动 否则会报错:修改 ...
gulp下静态资源的合并、压缩、MD5后缀 -
denverj:
感谢分享~
Emberjs学习
改造自MultiselectItemSelector(http://extjs.com/learn/Extension:Multiselect)。
原有代码在关闭该控件以后,会遗留大量无效代码,因此,自己用一个 panel + 2个grid来实现,暂不支持拖拽。
Ext.namespace('Ext.ux') Ext.ux.IconPanel = function(config){ Ext.apply(this,config); Ext.ux.IconPanel.superclass.constructor.call(this,config); } Ext.extend(Ext.ux.IconPanel,Ext.Panel,{ imagePath:'', drawUpIcon:true, drawDownIcon:true, drawLeftIcon:true, drawRightIcon:true, drawTopIcon:true, drawBotIcon:true, //style: 'padding-left:5px;padding-right:5px', initComponent: function(){ Ext.ux.IconPanel.superclass.initComponent.call(this); this.addEvents( '' ) }, onRender: function(ct, position){ Ext.ux.IconPanel.superclass.onRender.call(this,ct,position); if (this.imagePath!="" && this.imagePath.charAt(this.imagePath.length-1)!="/") this.imagePath+="/"; this.iconUp = this.imagePath + (this.iconUp || 'up2.gif'); this.iconDown = this.imagePath + (this.iconDown || 'down2.gif'); this.iconLeft = this.imagePath + (this.iconLeft || 'left2.gif'); this.iconRight = this.imagePath + (this.iconRight || 'right2.gif'); this.iconTop = this.imagePath + (this.iconTop || 'top2.gif'); this.iconBottom = this.imagePath + (this.iconBottom || 'bottom2.gif'); var el= this.getEl(); if (!this.toSortField) { this.toTopIcon = el.createChild({tag:'img', src:this.iconTop, style:{cursor:'pointer', margin:'2px'}}); el.createChild({tag: 'br'}); this.upIcon = el.createChild({tag:'img', src:this.iconUp, style:{cursor:'pointer', margin:'2px'}}); el.createChild({tag: 'br'}); } this.addIcon = el.createChild({tag:'img', src:this.switchToFrom?this.iconLeft:this.iconRight, style:{cursor:'pointer', margin:'2px'}}); el.createChild({tag: 'br'}); this.removeIcon = el.createChild({tag:'img', src:this.switchToFrom?this.iconRight:this.iconLeft, style:{cursor:'pointer', margin:'2px'}}); el.createChild({tag: 'br'}); if (!this.toSortField) { this.downIcon = el.createChild({tag:'img', src:this.iconDown, style:{cursor:'pointer', margin:'2px'}}); el.createChild({tag: 'br'}); this.toBottomIcon = el.createChild({tag:'img', src:this.iconBottom, style:{cursor:'pointer', margin:'2px'}}); } if (!this.readOnly) { if (!this.toSortField) { this.toTopIcon.on('click', this.toTop, this); this.upIcon.on('click', this.up, this); this.downIcon.on('click', this.down, this); this.toBottomIcon.on('click', this.toBottom, this); } this.addIcon.on('click', this.fromTo, this); this.removeIcon.on('click', this.toFrom, this); } if (!this.drawUpIcon || this.hideNavIcons) { this.upIcon.dom.style.display='none'; } if (!this.drawDownIcon || this.hideNavIcons) { this.downIcon.dom.style.display='none'; } if (!this.drawLeftIcon || this.hideNavIcons) { this.addIcon.dom.style.display='none'; } if (!this.drawRightIcon || this.hideNavIcons) { this.removeIcon.dom.style.display='none'; } if (!this.drawTopIcon || this.hideNavIcons) { this.toTopIcon.dom.style.display='none'; } if (!this.drawBotIcon || this.hideNavIcons) { this.toBottomIcon.dom.style.display='none'; } }, toTop:function(){ this.gridsHolder.fireEvent('toTop'); }, toBottom: function(){ this.gridsHolder.fireEvent('toBottom'); }, up: function(){ this.gridsHolder.fireEvent('up'); }, down: function(){ this.gridsHolder.fireEvent('down'); }, fromTo: function(){ this.gridsHolder.fireEvent('fromTo'); }, toFrom: function(){ this.gridsHolder.fireEvent('toFrom'); }, setGridsHoder: function(gridsHolder){ this.gridsHolder = gridsHolder; } }); Ext.ux.MultiSelectWin = function(config){ Ext.apply(this,config); Ext.ux.MultiSelectWin.superclass.constructor.call(this, config); this.init(); }; Ext.extend(Ext.ux.MultiSelectWin, Ext.util.Observable,{ title : '选择窗口', from_legend:'可选', to_legend: '已选', valueField: 'id', displayField: 'name', warningTitle: '提示', minLength:0, maxLength:Number.MAX_VALUE, minLengthText:'至少应选择{0}项', maxLengthText:'最多只能选择 {0}项', /** * 图标面板的config * @type {} */ iconConfig:{}, targetItem: null, localData:[], selectedData: [], saveFn: Ext.emptyFn, searchFn: Ext.emptyFn, baseParams: null, fieldName: null, toSortField:null, fromSortField:null, toSortDir:'ASC', fromSortDir:'ASC', allowDup: false, switchToFrom:false, openHeight:320, openWidth:460, ms_height:220, ms_width:200, init: function(){ this.initDataStore(); this.initComponent(); }, initDataStore: function(){ var record = Ext.data.Record.create([ { name: this.valueField, type: 'string' },{ name: this.displayField, type: 'string' }]); if (this.localMode == true){ this.fromStore = new Ext.data.SimpleStore({ fields:[this.valueField, this.displayField] }); } else{ var baseParams = { dir : 'asc', start : 0, limit : 0 }; if (this.baseParams) baseParams = this.baseParams; this.fromStore = new Ext.data.Store({ proxy: new Ext.data.DWRProxy(this.searchFn, true), reader: new Ext.data.ListRangeReader({ totalProperty : 'total', id : 'id' },record), sortInfo:{field:this.displayField,direction:'ASC'}, baseParams : baseParams }); } this.selectedData = this.targetItem.getArrayValue(); this.toStore = new Ext.data.SimpleStore({ fields:[this.valueField, this.displayField], data: this.selectedData }); if(this.allowDup == false){ this.fromStore.on('load',function(){ this.fromStore.filterBy(function(record){ for (var i=0;i < this.selectedData.length;i++){ if(this.selectedData[i][0] == record.get(this.valueField)) return false; } return true; },this); },this); } if(this.localMode == true) this.fromStore.loadData(this.localData); else this.fromStore.load(); }, reComputeWH: function(){ this.openHeight = this.openHeight; this.openWidth = this.openWidth; this.ms_height = this.openHeight - 100; this.ms_width = (this.openWidth-60)/2; }, createIconsPanel: function(){ this.iconsPanel = new Ext.ux.IconPanel(this.iconConfig); this.iconsPanel.setGridsHoder(this); }, initComponent: function(){ if(this.openHeight || this.openWidth){ this.reComputeWH(); } this.addEvents( /** * @event */ 'destroy', /** * @event */ 'toTop', /** * @event */ 'toBottom', /** * @event */ 'up', /** * @event */ 'down', /** * @event */ 'fromTo', /** * @event */ 'toFrom'); this.on('destroy', this.onDestroy, this); this.on('up', this.onUp, this); this.on('down', this.onDown, this); this.on('toTop', this.onToTop, this); this.on('toBottom', this.onToBottom, this); this.on('fromTo', this.onFromTo, this); this.on('toFrom', this.onToFrom, this); this.fromGrid = new Ext.grid.GridPanel({ title : '可选', hideHeaders:true, width : this.ms_width, height: this.ms_height, autoExpandColumn:'name', layout : 'fit', sm : new Ext.grid.RowSelectionModel(), ds : this.fromStore, cm : new Ext.grid.ColumnModel([{ header : "header", sortable : true, dataIndex : this.displayField }]), viewConfig:{forceFit:true} }) this.fromGrid.on('rowdblclick', this.onFromGriddblclick, this); this.toGrid = new Ext.grid.GridPanel({ title : '已选', hideHeaders:true, width : this.ms_width, height: this.ms_height, autoExpandColumn:'name', layout : 'fit', sm : new Ext.grid.RowSelectionModel(), ds : this.toStore, cm : new Ext.grid.ColumnModel([{ header : "header", sortable : true, dataIndex : this.displayField }]), viewConfig:{forceFit:true} }) this.toGrid.on('rowdblclick', this.onToGriddblclick, this); this.createIconsPanel(); this.parentPanel = new Ext.Panel({ layout:"table", layoutConfig:{columns:3}, items: [this.fromGrid,this.iconsPanel,this.toGrid], frame: true }); this.selectorWin = new Ext.Window({ frame: true, resizable:false, title : this.title, layout:'fit', modal: true, items : [this.parentPanel], width: this.openWidth, height: this.openHeight, buttonAlign:'center', buttons:[{ text: '确定', handler: function(){ var records = this.toStore.getRange(); if(this.validateValue(records) == false) return; var values = []; var selectedValue = ''; var selectedText = ''; for (var i=0; i < records.length; i++){ var temp = []; var v = records[i].get(this.valueField); var t = records[i].get(this.displayField); temp.push(v); temp.push(t); values.push(temp); if(selectedValue == ''){ selectedValue = v; selectedText = t; } else{ selectedValue = selectedValue + ',' + v; selectedText = selectedText + ',' + t; } } this.targetItem.setValue(values); var formValues = queryPanel.getFormValues(); Ext.apply(formValues,this.baseParams); formValues.selectedValue = selectedValue; formValues.selectedText = selectedText; var fn = this.saveFn.createSequence(function(returnData){}); fn(formValues); this.selectorWin.close(); }, scope:this },{ text:'取消', handler: function(){ this.selectorWin.close(); }, scope: this }] }) this.selectorWin.show(); }, validateValue : function(value){ if (value.length < this.minLength) { Ext.Msg.show({ title: this.warningTitle, msg: String.format(this.minLengthText, this.minLength), buttons: Ext.Msg.OK, icon: Ext.MessageBox.INFO }); return false; } if (value.length > this.maxLength) { Ext.Msg.show({ title: this.warningTitle, msg: String.format(this.maxLengthText, this.maxLength), buttons: Ext.Msg.OK, icon: Ext.MessageBox.INFO }); return false; } return true; }, onFromGriddblclick: function(){ this.fireEvent('fromTo'); }, onToGriddblclick: function(){ this.fireEvent('toFrom'); }, onUp:function(){ var store = this.toStore; var sm = this.toGrid.getSelectionModel(); var data = sm.getSelections(); var selectionsArray = []; for (var i=0; i < data.length; i++){ selectionsArray.push(store.indexOf(data[i])); } var record = null; selectionsArray.sort(); var newSelectionsArray = []; if (selectionsArray.length > 0) { for (var i=0; i<selectionsArray.length; i++) { record = store.getAt(selectionsArray[i]); if ((selectionsArray[i] - 1) >= 0) { store.remove(record); store.insert(selectionsArray[i] - 1, record); newSelectionsArray.push(selectionsArray[i] - 1); } } this.toGrid.getView().refresh(); sm.selectRows(newSelectionsArray); } }, onDown: function(){ var store = this.toStore; var sm = this.toGrid.getSelectionModel(); var data = sm.getSelections(); var selectionsArray = []; for (var i=0; i < data.length; i++){ selectionsArray.push(store.indexOf(data[i])); } var record = null; selectionsArray.sort(); selectionsArray.reverse(); var newSelectionsArray = []; if (selectionsArray.length > 0) { for (var i=0; i<selectionsArray.length; i++) { record = store.getAt(selectionsArray[i]); if ((selectionsArray[i] + 1) < store.getCount()) { store.remove(record); store.insert(selectionsArray[i] + 1, record); newSelectionsArray.push(selectionsArray[i] + 1); } } this.toGrid.getView().refresh(); sm.selectRows(newSelectionsArray); } }, onToTop: function(){ var store = this.toStore; var sm = this.toGrid.getSelectionModel(); var data = sm.getSelections(); var selectionsArray = []; for (var i=0; i < data.length; i++){ selectionsArray.push(store.indexOf(data[i])); } var records = []; if (selectionsArray.length > 0) { selectionsArray.sort(); for (var i=0; i<selectionsArray.length; i++) { record = store.getAt(selectionsArray[i]); records.push(record); } selectionsArray = []; for (var i=records.length-1; i>-1; i--) { record = records[i]; store.remove(record); store.insert(0, record); selectionsArray.push(((records.length - 1) - i)); } } this.toGrid.getView().refresh(); sm.selectRows(selectionsArray); }, onToBottom: function(){ var store = this.toStore; var sm = this.toGrid.getSelectionModel(); var data = sm.getSelections(); var selectionsArray = []; for (var i=0; i < data.length; i++){ selectionsArray.push(store.indexOf(data[i])); } var records = []; if (selectionsArray.length > 0) { selectionsArray.sort(); for (var i=0; i<selectionsArray.length; i++) { record = store.getAt(selectionsArray[i]); records.push(record); } selectionsArray = []; for (var i=0; i<records.length; i++) { record = records[i]; store.remove(record); store.add(record); selectionsArray.push((store.getCount()) - (records.length - i)); } } this.toGrid.getView().refresh(); sm.selectRows(selectionsArray); }, onFromTo: function(){ var records = this.fromGrid.getSelectionModel().getSelections(); var selectionsArray = []; for (var i=0; i < records.length; i++){ selectionsArray.push(this.fromStore.indexOf(records[i])); } if (selectionsArray.length > 0) { if(!this.allowDup) selectionsArray = []; for (var i=0; i<records.length; i++) { record = records[i]; if(this.allowDup){ var x=new Ext.data.Record(); record.id=x.id; delete x; this.toStore.add([record]); }else{ this.fromStore.remove(record); this.toStore.add([record]); selectionsArray.push((this.toStore.getCount() - 1)); } } } this.toGrid.getView().refresh(); this.fromGrid.getView().refresh(); if(this.toSortField) this.toStore.sort(this.toSortField, this.toSortDir); if(this.allowDup) this.fromGrid.getSelectionModel().selectRows(selectionsArray); else this.toGrid.getSelectionModel().selectRows(selectionsArray); }, onToFrom: function(){ var records = this.toGrid.getSelectionModel().getSelections(); var selectionsArray = []; if (records.length > 0) { for (var i=0; i<records.length; i++) { record = records[i]; this.toStore.remove(record); if(!this.allowDup){ this.fromStore.add([record]); selectionsArray.push((this.fromStore.getCount() - 1)); } } } this.fromGrid.getView().refresh(); this.toGrid.getView().refresh(); if(this.fromSortField) this.fromStore.sort(this.fromSortField, this.fromSortDir); this.fromGrid.getSelectionModel().selectRows(selectionsArray); }, onDestroy:function(){ this.toStore = null; this.toGrid = null; this.fromStore = null; this.fromGrid = null; } }); Ext.reg('multiSelectWin',Ext.ux.MultiSelectWin);
截图
发表评论
-
EXT零零碎碎
2011-06-01 15:09 01.Grid里面可以对多个字段映射为一个字段: " ... -
给Grid行添加Tip信息:
2011-06-01 14:53 1431在EXT3中,可以使用以下方法添加Tip信息: 1.给Grid ... -
窗口随页面滚动漂浮在同一位置
2010-06-25 09:03 1508var win = new Ext.Window( ... -
FF下字体小问题
2010-06-23 16:46 1151网络上有一份patch代码,不够实际应用中有点小问题。 于是自 ... -
强制combobox每次从后台获取数据
2010-06-22 15:50 2212combobox在第一次加载数据以后,就不再往后台获取数据了, ... -
使用图片创建简单的button
2010-06-22 15:42 1206代码: //具体样式的更改可以修改 style元素 ... -
阻止退格键导致页面跳转
2010-06-22 15:27 1616阻止退格键导致页面跳转,在程序中加入以下代码: ... -
default属性的应用
2010-06-22 15:25 1115关于default属性在container容器中(panle, ... -
Grid “操作”列的plugin
2010-06-19 11:06 1264尽管EXT的常用设计是把对GRID记录的操作放在tbar或者b ... -
Ext.ux.Upload.Dialog使用
2010-06-18 10:38 1300反正网络上都很多了。就上张PP吧。 -
自定义图片按钮
2010-06-07 17:15 1427/** * 定义图片按钮 * * @para ... -
设置Grid row 的高度
2010-06-07 09:04 1884对GridPanel 的GridView添加以下配置 v ...
相关推荐
首先,`MultiselectItemSelector` 提供了一个用户友好的界面,通常会显示一个可滚动的列表,用户可以通过勾选复选框来选择多个项目。这种组件的交互设计考虑了易用性和效率,使得用户可以快速地在大量数据中进行多选...
Python完整程序-Excel_更灵活的操作方式_xlsxwriter_openpyxl,含有完整的源码
2024年中国人工智能创业者人群画像报告
C标准库源码
C标准库源码
C标准库源码
C标准库源码
医院感染应知应会知识竞赛必刷题库及答案.docx
Python完整程序-wx_表情轰炸,含有完整的源码
C标准库源码
1.版本:matlab2014/2019a/2024a 2.附赠案例数据可直接运行matlab程序。 3.代码特点:参数化编程、参数可方便更改、代码编程思路清晰、注释明细。 4.适用对象:计算机,电子信息工程、数学等专业的大学生课程设计、期末大作业和毕业设计。
1.版本:matlab2014/2019a/2024a 2.附赠案例数据可直接运行matlab程序。 3.代码特点:参数化编程、参数可方便更改、代码编程思路清晰、注释明细。 4.适用对象:计算机,电子信息工程、数学等专业的大学生课程设计、期末大作业和毕业设计。
Python完整程序-用Python在Excel中查找并替换数据,含有完整的源码
Python完整程序-批量更改Excel文件中多个工作表的内容,含有完整的源码
Python完整程序-飞鸟,含有完整的源码
【提升效率】学会使用aiofiles模块,让Python文件操作更高效!.docx
基于STM32的监护报警系统.pdf
内容概要:本文全面解析了遗传算法 (GA),这是一种源自生物进化理论的智能优化算法。文章追溯了GA的起源与发展历史,从最初提出到现代广泛的应用场景。GA的核心在于借鉴自然选择、遗传变异和适者生存的原则,将其转化为计算机算法。文中详细解释了其基本原理——通过初始化种群、评价个体适应度、执行选择、交叉与变异操作,最终逐步逼近最优解。遗传算法不仅因其卓越的全局搜索能力和对不同问题类型的强大适应性而在学术界备受关注,在现实世界中亦表现出巨大价值,涵盖从函数优化、组合优化到机器学习乃至信号处理和控制系统等领域的诸多实际问题中均有成功案例。 适用人群:对于有一定计算机基础知识的专业人士及研究人员来说,这是理解新一代AI算法的良好素材。同时适合希望跨学科研讨的生物学爱好者或从事数据分析、人工智能研究的专业团队。 使用场景及目标:本篇文章既可以作为研究生、高校师生开展科学研究项目前的背景知识准备材料;也可以成为企业工程师进行新技术评估或现有项目升级改造时的重要参考资料。对于有兴趣深入了解AI内部运作机制的人来说,这篇文献还可以为其提供更多关于如何模拟自然界智能规律去破解人类面临的挑战的新思路。 其他说明:文章除了理论论述之外,还提供了具体实施示例,并指出了当前存在的局限性和未来的潜在发展方向,是一份极具启发意义的技术报告。
发那科FANUC电路板全套驱动图纸及原理图集合,电源图集,专业维修人员必备电路设计图集。,发那科FANUC电路板图纸 全套驱动图纸 原理图 电源图,维修人员必备电路图。 ,核心关键词:发那科FANUC电路板图纸; 全套驱动图纸; 原理图; 电源图; 维修人员必备电路图。,"发那科FANUC全套电路板及驱动原理图:维修人员必备电源维修手册"
C标准库源码