Ext TreeCombo 树形 下拉框

 

参考:http://www.extjs.com/forum/showthread.php?38654-Tree-in-a-Combo./page4

在别人基础上稍作修改

1.添加hiddenName,使传值时跟Ext.form.ComboBox类似;

2.设值时展开整棵树(在TreeCombo外实现),使弹出下拉框时默认选中节点;

 

代码如下:

/**
 * @version Base on Ext3.0
 * @class Ext.ux.TreeCombo
 * @extends Ext.form.TriggerField
 */

Ext.ux.TreeCombo = Ext.extend(Ext.form.TriggerField, {

	// triggerClass: 'x-form-tree-trigger',

	initComponent : function() {
		this.readOnly = true;
		Ext.ux.TreeCombo.superclass.initComponent.call(this);
		this.on('specialkey', function(f, e) {
					if (e.getKey() == e.ENTER) {
						this.onTriggerClick();
					}
				}, this);
		this.getTree();
	},

	onTriggerClick : function() {
		this.getTree().show();
		this.getTree().getEl().alignTo(this.wrap, 'tl-bl?');
	},

	getTree : function() {
		if (!this.treePanel) {
			if (!this.treeWidth) {
				this.treeWidth = Math.max(150, this.width || 200);
			}
			if (!this.treeHeight) {
				this.treeHeight = 200;
			}
			this.treePanel = new Ext.tree.TreePanel({
				renderTo : Ext.getBody(),
				loader : this.loader || new Ext.tree.TreeLoader({
							preloadChildren : (typeof this.root == 'undefined'),
							url : this.dataUrl || this.url
						}),
				root : this.root || new Ext.tree.AsyncTreeNode({
							children : this.children
						}),
				rootVisible : (typeof this.rootVisible != 'undefined')
						? this.rootVisible
						: (this.root ? true : false),
				floating : true,
				autoScroll : true,
				minWidth : 200,
				minHeight : 200,
				width : this.treeWidth,
				height : this.treeHeight,
				listeners : {
					hide : this.onTreeHide,
					show : this.onTreeShow,
					click : this.onTreeNodeClick,
					expandnode : this.onExpandOrCollapseNode,
					collapsenode : this.onExpandOrCollapseNode,
					resize : this.onTreeResize,
					scope : this
				}
			});
			this.treePanel.show();
			this.treePanel.hide();
			this.relayEvents(this.treePanel.loader, ['beforeload', 'load',
							'loadexception']);
			if (this.resizable) {
				this.resizer = new Ext.Resizable(this.treePanel.getEl(), {
							pinned : true,
							handles : 'se'
						});
				this.mon(this.resizer, 'resize', function(r, w, h) {
							this.treePanel.setSize(w, h);
						}, this);
			}
		}
		return this.treePanel;
	},

	onExpandOrCollapseNode : function() {
		if (!this.maxHeight || this.resizable)
			return; // -----------------------------> RETURN
		var treeEl = this.treePanel.getTreeEl();
		var heightPadding = treeEl.getHeight() - treeEl.dom.clientHeight;
		var ulEl = treeEl.child('ul'); // Get the underlying tree element
		var heightRequired = ulEl.getHeight() + heightPadding;
		if (heightRequired > this.maxHeight)
			heightRequired = this.maxHeight;
		this.treePanel.setHeight(heightRequired);
	},

	onTreeResize : function() {
		if (this.treePanel)
			this.treePanel.getEl().alignTo(this.wrap, 'tl-bl?');
	},

	onTreeShow : function() {
		Ext.getDoc().on('mousewheel', this.collapseIf, this);
		Ext.getDoc().on('mousedown', this.collapseIf, this);
	},

	onTreeHide : function() {
		Ext.getDoc().un('mousewheel', this.collapseIf, this);
		Ext.getDoc().un('mousedown', this.collapseIf, this);
	},

	collapseIf : function(e) {
		if (!e.within(this.wrap) && !e.within(this.getTree().getEl())) {
			this.collapse();
		}
	},

	collapse : function() {
		this.getTree().hide();
		if (this.resizer)
			this.resizer.resizeTo(this.treeWidth, this.treeHeight);
	},

	// private
	validateBlur : function() {
		return !this.treePanel || !this.treePanel.isVisible();
	},

	setValue : function(v) {
		this.startValue = this.value = v;
		if (this.treePanel) {
			var n = this.treePanel.getNodeById(v);//位于一级以下节点要树全部展开时才可用
			if (n) {
				n.select();//默认选中节点
				this.setRawValue(n.text);
				if (this.hiddenField)
					this.hiddenField.value = v;
			}
		}
	},

	getValue : function() {
		return this.value;
	},

	onTreeNodeClick : function(node, e) {
		this.setRawValue(node.text);
		this.value = node.id;
		if (this.hiddenField)
			this.hiddenField.value = node.id;
		this.fireEvent('select', this, node);
		this.collapse();
	},
	onRender : function(ct, position) {
		Ext.ux.TreeCombo.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);

			// prevent input submission
			this.el.dom.removeAttribute('name');
		}
	}
});

 

示例:

1:选择页面,在定义了根节点的情况下逐级加载

 

var businessId = new Ext.ux.TreeCombo({
			fieldLabel : '业务名称',
			width : 120,
			allowBlank : false,
			//name : 'param.businessId',
			hiddenName : 'param.businessId',
			rootVisible : true,
			root : new Ext.tree.AsyncTreeNode({
						text : '业务列表',
						expanded : true,
						levelNum : 0,
						id : '100000'
					}),
			dataUrl : 'getChild_business.do?param.superId=100000'
		});

businessId.treePanel.on('beforeload', function(node) {
	businessId.treePanel.loader.dataUrl = 'getChild_business.do?param.superId='
			+ node.id;});
后台请求回来的数据如: [{text:'业务23',id:'200024'},{text:'业务2',id:'200043'}]


 

   

 2.显示并修改(expandAll后再setValue)

var businessId = new Ext.ux.TreeCombo({
			fieldLabel : '业务名称',
			width : 120,
			allowBlank : false,
			hiddenName : 'param.businessId',
			rootVisible : false,
			dataUrl : 'getAllJson_business.do'
		});

businessId.treePanel.on('load', function() {
			businessId.setValue('<s:property value="#param.businessId" />');
		});
businessId.treePanel.expandAll();

 

后台请求返回的json如:
[{
			"id" : 100000,
			"text" : "业务列表",
			"leaf" : false,
			"superId" : 0,
			"children" : [{

						"id" : 200024,
						"text" : "业务23",
						"leaf" : false,
						"superId" : 100000,
						"children" : [...略]
					}, {

						"id" : 200043,
						"text" : "业务2",
						"leaf" : false,
						"superId" : 100000,
						"children" : [...略]
					}]
		}]

 

 

 
3.只读(直接用Ext.form.ComboBox)

后台数据返回对应项即可
[{"value":"200043","display":"业务2"}]

 

 

 

 

----------------------2012-12-04-------补充个用静态树的例子---------备忘---------------------------

 

var childrenArrData = 
			[{  id:'-1',
			  text:'根节点',
			  value:'-1',
			  leaf:false,
			  children:[{id:'100',text:'测试',serialStart:'-1',leaf:false,children:[]}]
			 }];
						
						
var treeCombo = new Ext.ux.TreeCombo({
	fieldLabel : 'xx',
	width : 300,
	name : 'treeCombo',
	hiddenName : 'treeCombo',
	rootVisible : false,
	root:new Ext.tree.AsyncTreeNode({
	   id:"-1",   
	   text:"根节点", 
	   expanded:true,
	   leaf:false,
	   children: childrenArrData
	})
});
	
treeCombo.treePanel.on('click',function(node){
	alert(node.attributes.value);//取节点属性
});

//先展开,再设值。这样才会显示text值,不然会显示value去
function setTaskSerial(val){
	treeCombo.treePanel.expandAll();
	treeCombo.setValue(val);
}
   
function gettreeCombo(){
	return treeCombo.getValue();
}

   ----------------------2012-12-04-------补充只读不可编辑---------备忘---------------------------

	onTriggerClick : function() {
		if(!this.disabled){//modify 20121204
			this.getTree().show();
			this.getTree().getEl().alignTo(this.wrap, 'tl-bl?');
		}
	},
    在原来的基础上加个判断,这样treeCombo.disable();后点击下拉箭头就能不让下拉了。

 

Extjs4.X下comboboxTree下拉树型菜单,完美支持多选、单选,绝对好用 Extjs4 comboboxTree下拉树型菜单,完美支持多选、单选,绝对好用。来源于网络,稍作修改。 立即下载

相关推荐

TreeCombo,Ext TreeCombo 树形 下拉框,树形下拉框

TreeCombo,Ext TreeCombo 树形 下拉框,树形下拉框

extjs树形下拉框

实现一、TreeField控件   TreeField的实现代码如下   JScript 代码   复制 Ext.form.TreeField = Ext.extend(Ext.form.TriggerField, { /** * @cfg {Boolean} readOnly * 设置为只读状态 * */

周厉的技术人生 1227

EXT下拉框显示树形结构源代码

EXT下拉框显示树形结构源代码EXT下拉框显示树形结构源代码

Ext TreeCombo 树形 下拉框,树形下拉框,EXT树形

1.添加hiddenName,使传值时跟Ext.form.ComboBox类似; 2.设值时展开整棵树(在TreeCombo外实现),使弹出下拉框时默认选中节点;   代码如下: Js代码   /**   * @version Base on Ext3.0   * @class Ext.ux.TreeCombo   * @extends Ext.

hepeng_8的专栏 4093

Extjs4 下拉树 TreeCombo

简单的修改下Extjs 的引用路径 双击Index.html 就可以看到效果了。

英飞凌TC377的Flash管理、UCB配置与HSM安全机制解析

本文深入解析了英飞凌TC377微控制器的Flash存储结构、UCB配置机制与HSM安全模块。详细阐述了带Cache与不带Cache的PFlash地址访问差异、利用SOTA与AB Swap实现无感OTA更新的原理,以及如何通过UCB安全配置启动流程与写保护。重点剖析了HSM硬件安全模块在密钥管理、安全启动与安全OTA中的核心作用,为开发高可靠性嵌入式系统提供实战指南。

weixin_29170327的博客 524

extjs tree下拉列表_Ext TreeCombo 树形 下拉框

参考:http://www.extjs.com/forum/showthread.php?38654-Tree-in-a-Combo./page4在别人基础上稍作修改1.添加hiddenName,使传值时跟Ext.form.ComboBox类似;2.设值时展开整棵树(在TreeCombo外实现),使弹出下拉框时默认选中节点;代码如下:/*** @version Base on Ext3.0* @c...

weixin_42505477的博客 542

【01】VisionMaster入门到精通——VisionMaster V4.0.0 试用版安装教程(安装试用补丁与试用授权)

本文详细介绍了海康VisionMaster 4.0.0试用版的安装步骤:首先从官网下载基础安装包、软加密试用版和示例程序(可选);安装时需按顺序完成主程序安装(选择软加密)、试用补丁安装和30天试用授权安装;最后提供了两种启动方式。文章还列出了试用版的7项功能限制,包括最多支持2个流程、2个全局相机等,并特别提醒试用版不维护、不提供补丁,建议用户转为正式版本。安装过程中若出现蓝屏需重启覆盖安装,授权失败时可参考指定解决方案。

程序员,他们想的是什么?他们想的永远都是技术,他们崇尚的也永远都是技术。 8959

extjs tree下拉列表_Ext5实现树形下拉框ComboBoxTree

Ext.define('Ext.ux.ComboBoxTree', {extend: 'Ext.form.field.Picker',requires: ['Ext.tree.Panel'],alias: ['widget.comboboxtree'],multiSelect: false,multiCascade: true,rootVisible: false,displayField: 't...

weixin_39926016的博客 355

手把手教你用西门子博图V18配置阿特拉斯PF6000拧紧枪PN通讯(附完整GSD文件与ToolsTalk配置文件)

本文详细介绍了如何使用西门子博图V18配置阿特拉斯PF6000拧紧枪的PN通讯,包括硬件连接、网络参数规划、ToolsTalk软件配置及博图工程设置。通过完整的GSD文件和配置文件,帮助工程师快速实现高精度拧紧设备与PLC的高效通讯,适用于汽车装配和电子制造等工业自动化场景。

weixin_42662293的博客 605

SQL Server2008详细安装步骤(超详细步骤)

https://pan.baidu.com/s/1yvolqfU-AbiuGrIzblA7pA 提取码:lzw81.下载好安装包后解压到除C盘以外的磁盘,避免系统卡顿2.使用管理员身份打开安装程序注意:使用管理员身份打开时,此时如果显示以下画面属于正常现象,下载安装即可。因为.net现在有很多软件都需要,包括SQLSERVER2008,它里面有visual studio都要有net,电脑系统没有的话安装一下好了。3.选择全新安装或向现有安装添加新功能4.点击确定5.出现以下画面之后,输入产品密钥即可(密钥在

m0_67402774的博客 4万+

Extjs中ComboBoxTree的实现

最近涉及到的一个项目中,需要实现ComboBoxTree的效果,首先,看看效果吧…… 在Extjs中是没有这种效果的,所以得自己写,在网络上看了看别人的资料,自己再总结了一下,修改了一下,代码如下: Ext.ux.TreeCombo = Ext.extend(Ext.form.ComboBox, { constructor: function (cfg) { ...

weixin_30681121的博客 430

小白快速上手 labelimg:新手图像标注详解教程

本教程主要帮助没有使用过labelimg的小白上手该软件,快速学会基本操作和打标签,为数据集准备打下基础。

小白一枚~ 2万+

extjs 下拉日期_extjs树形下拉框

Ext.ux.TreeCombo的方式Ext.ux.TreeCombo = Ext.extend(Ext.form.ComboBox, {constructor: function (cfg) {cfg = cfg || {};Ext.ux.TreeCombo.superclass.constructor.call(this, Ext.apply({maxHeight: 300,editable:...

weixin_42637593的博客 130

基于逆向工程的中国裁判文书网爬虫技术深度解析:从反爬破解到合规抓取

最近承接了一个法律大数据分析的项目,需要获取某类合同纠纷的裁判文书数据,用于分析不同地区的判决规律、法官的裁判倾向以及法条适用情况。原本以为用常规的Python爬虫就能搞定,结果刚对着中国裁判文书网发了几个请求,就遭遇了“滑铁卢”:要么请求直接返回403 Forbidden,要么触发滑块验证码,甚至连IP都被临时封禁了。普通的requests+BeautifulSoup组合在裁判文书网面前完全失效,这也让我意识到,想要获取这里的数据,必须先通过逆向工程拆解网站的请求逻辑和反爬机制。经过一周的摸索,从抓包分析

专注于Python爬虫开发,分享爬虫技巧、项目实战与反爬经验,使用Scrapy、BeautifulSoup等工具,解决数据抓取难题。 3173

如何免费快速的部署一个自用免VIP的自动追剧工具!NAS新玩法!豆瓣与迅雷结合,轻松实现自动下载电影自动追剧功能(支持Windows,群晖nas,飞牛nas,软路由,服务器等Docker快速部署)

追剧党狂喜!豆瓣追剧神器,自动添加云盘,自动下载,微信通知,一键搞定!

XiaoqiangClub的博客 4588

TreeCombo

/** Sample json load code :* Ext.getCmp('<combotree>').loadTree(url,params) * url : '../..../....Action.do?islem=giris '* params : {'itemId':Ext.getCmp('item').getValue()}** Animal's TreeCombo ...

weixin_30312659的博客 136

第170篇 因子图优化入门——图模型在状态估计中的应用

本文系统介绍了从滤波方法到因子图优化的思维转变,重点解析了因子图的原理与应用。首先对比了递推式滤波(卡尔曼滤波等)与全局优化的区别,指出优化方法能利用所有信息且适合处理稀疏结构。然后详细阐述了因子图的二部图结构(变量节点和因子节点)及其将复杂概率分布分解为小因子乘积的优势。文章讲解了因子图优化如何转化为最小二乘问题,并介绍高斯-牛顿法和LM方法等求解技术。最后对比了g2o、Ceres和GTSAM三大主流框架的特点及适用场景,强调了初始化和鲁棒核函数的重要性,为SLAM相关面试提供了实用建议。

郑伟强dev的专栏 374

CooliteToolkit(v8.0)用ComBoxTree封装的TreeCombo控件(2)

ComboTree.cs代码: using System;using System.Collections.Generic;using System.ComponentModel;using System.Drawing;using System.Linq;using System.Text;using System.Web.UI;using Coolite.Ext.Web; [assembl

chy2z的专栏 247

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

使用TreeCombo示例

createClassTreeCombo: function (comboConfig) { comboConfig = Bronze.AES.Form.initConfig(comboConfig); var uiProvider; if (comboConfig.checkModel) { var isRichUI = Bronz...

weixin_30673715的博客 172

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

extjs tree下拉列表_Extjs中ComboBoxTree实现的下拉框树效果(自写)_extjs

最近涉及到的一个项目中,需要实现ComboBoxTree的效果,首先,看看效果吧…… 在Extjs中是没有这种效果的,所以得自己写,在网络上看了看别人的资料,自己再总结了一下,修改了一下,代码如下:Ext.ux.TreeCombo = Ext.extend(Ext.form.ComboBox, {constructor: function (cfg) {cfg = cfg || {};Ext.ux...

weixin_29214559的博客 384

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

extjs4.1下改combobox为treecombo 并带有check

1、功能描述: 最近用户要求在combobox选择填入时,能够在树结构中选择节点,并保存和修改。 2、代码展示: Ext.define("HgTreeCheckCombo", { extend : "Ext.form.field.ComboBox", alias : 'widget.hgtreecheckcombo', requires : [], multiSelect : tru

qijianglin的专栏 1113

extjs2.0 ie8 下拉树_ExtJs下拉树的实现

直接上代码:Ext.ux.TreeCombo = Ext.extend(Ext.form.ComboBox, {constructor : function(cfg) {cfg = cfg || {};Ext.ux.TreeCombo.superclass.constructor.call(this, Ext.apply({maxHeight : 300,editable : false,mode...

weixin_30127493的博客 204

Extjs项目中uxForm.js

Ext.namespace("Ext.ux"); Ext.override(Ext.form.TextField, { //区别汉字和英文的长度 validateValue : function(value){ var strLen = this.countStrLen(value); if(value.length < 1 |

qq1099866969的专栏 1172
上一篇: Ext 必填项 *
下一篇: Struts 提交对象集合 列表List
fireinjava
博客等级 码龄20年 5粉丝 53原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值