- 浏览: 384856 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
消失-IT超市:
方便加一下你的QQ吗,我的QQ是252375879,有个问题请 ...
js调用ocx控件(读写IC卡) -
mszb00123:
很有用
Extjs之--图片上传器 -
shouhouhuakai:
好崇拜,不错
URLConnection的连接、超时、关闭用法总结 -
wujierd:
写得好详细,学习了
URLConnection的连接、超时、关闭用法总结 -
paruke:
请问这个能加上图片旋转功能么 我试了一下 发现寻找中心点是个问 ...
Extjs之--图片浏览器
1、效果如图
2、 引入TreeField控件(转载)
Ext.form.TreeField = Ext.extend(Ext.form.TriggerField, { /** * @cfg {Boolean} readOnly * 设置为只读状态 * */ readOnly : true , /** * @cfg {String} displayField * 用于显示数据的字段名 * */ displayField : 'text', /** * @cfg {String} valueField * 用于保存真实数据的字段名 */ valueField : null, /** * @cfg {String} hiddenName * 保存真实数据的隐藏域名 */ hiddenName : null, /** * @cfg {Integer} listWidth * 下拉框的宽度 */ listWidth : null, /** * @cfg {Integer} minListWidth * 下拉框最小宽度 */ minListWidth : 50, /** * @cfg {Integer} listHeight * 下拉框高度 */ listHeight : null, /** * @cfg {Integer} minListHeight * 下拉框最小高度 */ minListHeight : 50, /** * @cfg {String} dataUrl * 数据地址 */ dataUrl : null, /** * @cfg {Ext.tree.TreePanel} tree * 下拉框中的树 */ tree : null, /** * @cfg {String} value * 默认值 */ value : null, /** * @cfg {String} displayValue * 用于显示的默认值 */ displayValue : null, /** * @cfg {Object} baseParams * 向后台传递的参数集合 */ baseParams : {}, /** * @cfg {Object} treeRootConfig * 树根节点的配置参数 */ treeRootConfig : { id : ' ', text : '全国', draggable:false }, /** * @cfg {String/Object} autoCreate * A DomHelper element spec, or true for a default element spec (defaults to * {tag: "input", type: "text", size: "24", autocomplete: "off"}) */ defaultAutoCreate : {tag: "input", type: "text", size: "24", autocomplete: "off"}, initComponent : function(){ Ext.form.TreeField.superclass.initComponent.call(this); this.addEvents( 'select', 'expand', 'collapse', 'beforeselect' ); }, initList : function(){ if(!this.list){ var cls = 'x-treefield-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.innerList = this.list.createChild({cls:cls+'-inner'}); this.innerList.setWidth(lw - this.list.getFrameWidth('lr')); this.innerList.setHeight(this.listHeight || this.minListHeight); if(!this.tree){ this.tree = this.createTree(this.innerList); } this.tree.on('click',this.select,this); this.tree.render(); } }, onRender : function(ct, position){ Ext.form.TreeField.superclass.onRender.call(this, ct, position); if(this.hiddenName){ this.hiddenField = this.el.insertSibling({tag:'input', type:'hidden', name: this.hiddenName, id: (this.hiddenId||this.hiddenName)}, 'before', true); 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'); } this.initList(); }, select : function(node){ if(this.fireEvent('beforeselect', node, this)!= false){ this.onSelect(node); this.fireEvent('select', this, node); } }, onSelect:function(node){ this.setValue(node); this.collapse(); }, createTree:function(el){ var Tree = Ext.tree; var tree = new Tree.TreePanel({ el:el, autoScroll:true, animate:true, containerScroll: true, rootVisible: false, loader: new Tree.TreeLoader({ dataUrl : this.dataUrl, baseParams : this.baseParams }) }); var root = new Tree.AsyncTreeNode(this.treeRootConfig); tree.setRootNode(root); return tree; }, getValue : function(){ if(this.valueField){ return typeof this.value != 'undefined' ? this.value : ''; }else{ return Ext.form.TreeField.superclass.getValue.call(this); } }, setValue : function(node){ //if(!node)return; var text,value; if(node && typeof node == 'object'){ text = node[this.displayField]; value = node[this.valueField || this.displayField]; }else{ text = node; value = node; } if(this.hiddenField){ this.hiddenField.value = value; } Ext.form.TreeField.superclass.setValue.call(this, text); this.value = value; }, onResize: function(w, h){ Ext.form.TreeField.superclass.onResize.apply(this, arguments); if(this.list && this.listWidth == null){ var lw = Math.max(w, this.minListWidth); this.list.setWidth(lw); this.innerList.setWidth(lw - this.list.getFrameWidth('lr')); } }, validateBlur : function(){ return !this.list || !this.list.isVisible(); }, onDestroy : function(){ if(this.list){ this.list.destroy(); } if(this.wrap){ this.wrap.remove(); } Ext.form.TreeField.superclass.onDestroy.call(this); }, collapseIf : function(e){ if(!e.within(this.wrap) && !e.within(this.list)){ this.collapse(); } }, 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); }, expand : function(){ if(this.isExpanded() || !this.hasFocus){ return; } this.onExpand(); this.list.alignTo(this.wrap, this.listAlign); this.list.show(); Ext.getDoc().on('mousewheel', this.collapseIf, this); Ext.getDoc().on('mousedown', this.collapseIf, this); this.fireEvent('expand', this); }, onExpand : function(){ var doc = Ext.getDoc(); this.on('click',function(){alert(111)},this); }, isExpanded : function(){ return this.list && this.list.isVisible(); }, onTriggerClick : function(){ if(this.disabled){ return; } if(this.isExpanded()){ this.collapse(); }else { this.onFocus({}); this.expand(); } this.el.focus(); } }); Ext.reg('treeField', Ext.form.TreeField);
3、使用该控件1
{ xtype: 'treeField', name: 'pigSource', fieldLabel: '来源地', emptyText:'选择来源地...', listWidth:200, listHeight:200, readOnly:false, dataUrl:'selectCouty.do' }
使用该控件2
xtype: 'treeField', hiddenName: 'pigSourceName', id:'pigSourceName_dzid', displayField : 'text', valueField: 'id', fieldLabel:'产地', labelSeparator: ':' + ' <img src="'+ Ext.NEEDED_IMAGE_URL + '"/>', emptyText:'选择产地...', listWidth:200, listHeight:200, readOnly:false, dataUrl:'selectCouty.do', allowBlank : false, blankText :'请选择产地', listeners:{ select:{ fn: function(cob){ var rvtext = cob.getRawValue(); var rvid = cob.getValue(); if(rvid.length!=0){ Ext.getCmp('pigSourceNo_dzid').setValue(rvid); Ext.getCmp('pigSourceName_dzid').setValue(rvtext); } } } }, msgTarget :'side'
4、数据来源通过selectCounty.do获取(如下例子)
@RequestMapping("/selectCouty.do") public String selectCouty(Model model) { List<County> provincelist = null; List<County> citylist = null; List<County> countylist = null; County province = null; // 省级 County city; // 市级 County county;//县级 provincelist = new ArrayList<County>(); province = new County("620000", "甘肃省"); citylist = new ArrayList<County>(); city = new County("620100", "兰州市"); countylist = new ArrayList<County>(); county = new County("620101", "市辖区"); county = new County("620102", "城关区"); county = new County("620103", "七里河区"); countylist.add(county); city.setChildren(countylist); citylist.add(city); province.setChildren(citylist); provincelist.add(province); JSONArray json = JSONArray.fromObject(provincelist); return JsonUtils.returnJsonModelAndView(model, json); }
发表评论
-
【转】ExtJS日历控件在chrome显示异常(布满整个屏幕)的解决办法
2014-12-01 15:33 722解决办法: 一、在date ... -
支持手工输入的combo问题处理
2014-11-15 16:01 6101、说明 可手工输入内容的combo,当手工输入值后,提交 ... -
Extjs grid 合计
2012-05-31 14:28 18791、直接在客户端统计,动态的修改Grid 2、代码如下 ... -
extjs2.x中带有拼音检索功能combo
2012-04-22 16:17 22901、extjs2.2版本 2、js代码示例 / ... -
Extjs2.x中使用htmleditor遇到的问题记录
2011-10-16 10:37 16471、IE6下htmleditor文本编辑器无法显示 解决:删 ... -
Extjs ComboBox根据条件的分页查询
2011-09-07 19:07 13531、说明 extjs combo经常会根据其他文本框 ... -
Extjs2.x bug解决-Combobox,hideTrigger:true 在IE下无法显示
2011-09-07 18:09 1482关于Exjts2.2.1中comboBox控件设置了hideT ... -
Extjs数据提交方式--单独Ajax提交
2011-08-07 11:31 44771、一般分为“form的submit提交”、“单独Ajax提交 ... -
extjs项目断网,图片显示不全
2011-01-10 23:23 16341、造成该问题的原因 在导入的JavaScript ... -
关于修补Ext2.2 datefield IE8 下显示不全的bug
2010-09-09 22:44 2161关于Exjts2.2.1中datefield控件在IE8下显示 ... -
Extjs之--图片上传器
2010-09-03 23:54 120061、效果图: 点击文本框后图标,弹出图片上传窗口 ... -
Extjs之--图片浏览器
2010-08-31 22:31 76661、效果图 2、此实例是在 http://yourga ... -
Extjs之--带分页的lovcombo控件
2010-08-26 23:14 29471、效果图: 2、js部分 { id:'l ... -
Extjs grid带分页的查询
2009-09-09 12:32 62571、先按条件查询数据,再点下一页保留住查询条件,解决方案是将查 ... -
Extjs之--combox分页功能
2009-03-15 22:16 4519效果图: js部分 关键参数: mode:'r ...
相关推荐
EXTJS 选下拉框,并取得下拉框的值,直接可以打开
extjs多选 下拉框扩展
ExtJs常用布局--layout详解实例代码: ExtJs常见的布局方式有:border、form、absolute、column、accordion、table、fit、card、anchor 另外,不常见的布局有:tab、vbox、hbox 具体使用方法可见该文件的案例代码。 ...
最近小弟做了Extjs实现实现下拉框联动的效果,参考了好久才学会,闲下来发一个简单的例子。。呵呵
一个extjs的OA项目 extjs-OA extjs-oaextjs-OA extjs-oa
extjs实现下拉框多选,很实用哦!
extjs2----关于extjs 的使用,操作.比较初级,但是也比较使用。适合初步接触extjs的朋友
ExtJS快速入门--传智播客--蔡世友
ExtJS----HelloWorld程序源码
extjs in action 1-6章节 pdf extjs in action 1-6章节 pdf
Extjs应用案例: 本酒店管理系统采用三层架构,SQL Server数据库。最主要的是采用了Extjs框架。 酒店系统实现了部分功能。aspx后台页面几乎无代码。业务逻辑处理全部采用Extjs自带的函数。对于学习Extjs的框架的...
Extjs4---combobox省市区三级联动+struts2
extJs2.0+spket-1.6.11.zip extJs2.0+spket-1.6.11.zip
Extjs4---grid的修改、删除功能---结合struts2、hibernate
extjs_4.1.0_community_extjs4-mvc-complex-dashboard
Extjs 4.1 下拉框 Tree 的实现(mvc)
EXTJS开发包ext-3.2.0 EXTJS开发包ext-3.2.0
Extjs3.4.0版本 多选下拉框效果支持多选/全选/全不选, 附源码。 修复不能多选问题,代码仅供参考
extjs-theme-bootstrap-master.zip