extjs4 点击按钮出现tree,选择一个节点,显示到文本框
来源:互联网 发布:青海省教育扶贫数据 编辑:程序博客网 时间:2024/06/05 02:15
if (Ext.getCmp('addAddressWindow')) {
Ext.getCmp('addAddressWindow').show();
} else {
Ext.create('Ext.Window', {
title : '添加地区',
width : 700,
height : 400,
layout : 'fit',
draggable :false,
modal : true,
id : 'addAddressWindow',
items : [
allform = new Ext.form.FormPanel({
id:'allform',
bodyPadding : 20,
autoScroll:true,
items : [
{
hideEmptyLabel :false,
xtype : 'displayfield',
value : '<span style=color:red>*</span>为必填选项'
},
{
xtype : 'fieldcontainer',
id : 'omsAddress',
width : 600,
padding : '0 0 10 0',
defaults : {
flex : 1
},
layout : 'table',
layoutConfig:{columns:3},
items : [{
fieldLabel : ' 所在地区',
xtype : 'textfield',
id : 'omsAddressParentName',
name : 'omsAddressParentName',
readOnlyCls : 'disable',
padding : '0 0 10 0',
width : 300,
readOnly: false
},{
xtype : 'displayfield',
hidden : true,
id : 'omsAddressParentId',
name : 'omsAddressParentId'
}, {
xtype : 'button',
text : '选择',
padding : '0 0 10 0',
handler : function(){
Ext.getCmp('chooseAddressId').show();
}
},{
xtype : 'button',
text : '取消选择',
padding : '0 0 10 0',
handler : function(){
//清空 所有的值
Ext.getCmp('omsAddressParentName').setValue('');
Ext.getCmp('omsAddressParentId').setValue('');
sureAddressName = '';
sureAddressSysId = '';
sureAddressLevel = '';
}
}]
},
Ext.create("Ext.panel.Panel",{
autoScroll:true,
id:'chooseAddressId',
layout : 'fit',
hidden:true,
width:600,
height:200,
items:[
sureTree = Ext.create("Ext.tree.Panel",{
id:'chooseTreeId',
selModel: Ext.create('Ext.selection.CheckboxModel', {
checkOnly: false
}),
listeners: {
selectionchange: function(thiz, selections){
if(selections.length==1){
sureAddressName = selections[0].data.text;
sureAddressSysId = selections[0].data.id;
sureAddressLevel = selections[0].data.level;
}
sureAddressLength = selections.length;
}
},
width:600,
height:120,
singleExpand: true,
rootVisible: false, //默认不显示根节点
root: {
id:'root',
leve:0,
text: ''
},
store:store1
}),
{
xtype : 'button',
id : 'btnSure',
height : 24,
text : '确定',
iconCls : 'icon-edit',
handler : function(){
if(sureAddressLength==0){
alert("请选择一个地址");
}else if(sureAddressLength>1){
alert("只能选择一个地址");
}else{
Ext.getCmp('omsAddressParentName').setValue(sureAddressName);
Ext.getCmp('omsAddressParentId').setValue(sureAddressSysId);
Ext.getCmp('chooseAddressId').hide();
sureAddressLength=0;
Ext.getCmp('chooseTreeId').getStore().load();
}
}
}
]
}),
{
fieldLabel : '<span style=color:red>*</span>地址ID',
xtype : 'textfield',
id : 'omsAddressCode',
name : 'omsAddressCode',
padding : '0 0 10 0',
allowBlank : false,
blankText : "不能为空",
width : 300,
maxLength : 20,
maxLengthText : '最大长度不能超过20个字符!',
regex:/^[0-9|a-z|_|A-Z]+$/,
regexText:"地址id无效"
},
{
hideEmptyLabel :false,
xtype : 'displayfield',
value : '不超过20个字节(数字,字母和下划线组成)'
},
{
fieldLabel : '<span style=color:red>*</span>地区名称',
xtype : 'textfield',
id : 'omsAddressName',
name : 'omsAddressName',
padding : '0 0 10 0',
allowBlank : false,
blankText : "不能为空",
width : 300,
maxLength : 50,
maxLengthText : '最大长度不能超过50个字符!'
},
{
hideEmptyLabel :false,
xtype : 'displayfield',
value : '不超过50个字节'
},
{
fieldLabel : '邮编',
xtype : 'textfield',
id : 'omsAddressZip',
name : 'omsAddressZip',
padding : '0 0 10 0',
allowBlank : false,
blankText : "不能为空",
width : 300
},
{
fieldLabel: ' 虚拟仓库名(可多选)',
xtype: 'combo',
id: 'omsWarehouseAddress',
name: 'omsWarehouseAddress',
store:virtualWarehouseStore,
width:500,
displayField : 'omsVirtualWarehouseName',
valueField : 'omsVirtualWhSysId',
editable: false,
padding:'0 0 10 0',
multiSelect: true,
autoShow: true
},
{
xtype : 'fieldcontainer',
fieldLabel : ' 状态',
width : 300,
defaultType : 'radiofield',
padding : '0 0 10 0',
defaults : {
flex : 1
},
layout : 'hbox',
items : [{
boxLabel : '启用',
name : 'size',
inputValue : '1',
id : 'addressStatusRadio1',
checked : true
}, {
boxLabel : '禁用',
name : 'size',
inputValue : '0',
id : 'addressStatusRadio2'
}]
},
{
xtype : 'button',
text : '保存',
iconCls : 'icon-orderCancel',
handler : saveAddress
}]
})]
}).show();
}
Ext.getCmp('addAddressWindow').show();
} else {
Ext.create('Ext.Window', {
title : '添加地区',
width : 700,
height : 400,
layout : 'fit',
draggable :false,
modal : true,
id : 'addAddressWindow',
items : [
allform = new Ext.form.FormPanel({
id:'allform',
bodyPadding : 20,
autoScroll:true,
items : [
{
hideEmptyLabel :false,
xtype : 'displayfield',
value : '<span style=color:red>*</span>为必填选项'
},
{
xtype : 'fieldcontainer',
id : 'omsAddress',
width : 600,
padding : '0 0 10 0',
defaults : {
flex : 1
},
layout : 'table',
layoutConfig:{columns:3},
items : [{
fieldLabel : ' 所在地区',
xtype : 'textfield',
id : 'omsAddressParentName',
name : 'omsAddressParentName',
readOnlyCls : 'disable',
padding : '0 0 10 0',
width : 300,
readOnly: false
},{
xtype : 'displayfield',
hidden : true,
id : 'omsAddressParentId',
name : 'omsAddressParentId'
}, {
xtype : 'button',
text : '选择',
padding : '0 0 10 0',
handler : function(){
Ext.getCmp('chooseAddressId').show();
}
},{
xtype : 'button',
text : '取消选择',
padding : '0 0 10 0',
handler : function(){
//清空 所有的值
Ext.getCmp('omsAddressParentName').setValue('');
Ext.getCmp('omsAddressParentId').setValue('');
sureAddressName = '';
sureAddressSysId = '';
sureAddressLevel = '';
}
}]
},
Ext.create("Ext.panel.Panel",{
autoScroll:true,
id:'chooseAddressId',
layout : 'fit',
hidden:true,
width:600,
height:200,
items:[
sureTree = Ext.create("Ext.tree.Panel",{
id:'chooseTreeId',
selModel: Ext.create('Ext.selection.CheckboxModel', {
checkOnly: false
}),
listeners: {
selectionchange: function(thiz, selections){
if(selections.length==1){
sureAddressName = selections[0].data.text;
sureAddressSysId = selections[0].data.id;
sureAddressLevel = selections[0].data.level;
}
sureAddressLength = selections.length;
}
},
width:600,
height:120,
singleExpand: true,
rootVisible: false, //默认不显示根节点
root: {
id:'root',
leve:0,
text: ''
},
store:store1
}),
{
xtype : 'button',
id : 'btnSure',
height : 24,
text : '确定',
iconCls : 'icon-edit',
handler : function(){
if(sureAddressLength==0){
alert("请选择一个地址");
}else if(sureAddressLength>1){
alert("只能选择一个地址");
}else{
Ext.getCmp('omsAddressParentName').setValue(sureAddressName);
Ext.getCmp('omsAddressParentId').setValue(sureAddressSysId);
Ext.getCmp('chooseAddressId').hide();
sureAddressLength=0;
Ext.getCmp('chooseTreeId').getStore().load();
}
}
}
]
}),
{
fieldLabel : '<span style=color:red>*</span>地址ID',
xtype : 'textfield',
id : 'omsAddressCode',
name : 'omsAddressCode',
padding : '0 0 10 0',
allowBlank : false,
blankText : "不能为空",
width : 300,
maxLength : 20,
maxLengthText : '最大长度不能超过20个字符!',
regex:/^[0-9|a-z|_|A-Z]+$/,
regexText:"地址id无效"
},
{
hideEmptyLabel :false,
xtype : 'displayfield',
value : '不超过20个字节(数字,字母和下划线组成)'
},
{
fieldLabel : '<span style=color:red>*</span>地区名称',
xtype : 'textfield',
id : 'omsAddressName',
name : 'omsAddressName',
padding : '0 0 10 0',
allowBlank : false,
blankText : "不能为空",
width : 300,
maxLength : 50,
maxLengthText : '最大长度不能超过50个字符!'
},
{
hideEmptyLabel :false,
xtype : 'displayfield',
value : '不超过50个字节'
},
{
fieldLabel : '邮编',
xtype : 'textfield',
id : 'omsAddressZip',
name : 'omsAddressZip',
padding : '0 0 10 0',
allowBlank : false,
blankText : "不能为空",
width : 300
},
{
fieldLabel: ' 虚拟仓库名(可多选)',
xtype: 'combo',
id: 'omsWarehouseAddress',
name: 'omsWarehouseAddress',
store:virtualWarehouseStore,
width:500,
displayField : 'omsVirtualWarehouseName',
valueField : 'omsVirtualWhSysId',
editable: false,
padding:'0 0 10 0',
multiSelect: true,
autoShow: true
},
{
xtype : 'fieldcontainer',
fieldLabel : ' 状态',
width : 300,
defaultType : 'radiofield',
padding : '0 0 10 0',
defaults : {
flex : 1
},
layout : 'hbox',
items : [{
boxLabel : '启用',
name : 'size',
inputValue : '1',
id : 'addressStatusRadio1',
checked : true
}, {
boxLabel : '禁用',
name : 'size',
inputValue : '0',
id : 'addressStatusRadio2'
}]
},
{
xtype : 'button',
text : '保存',
iconCls : 'icon-orderCancel',
handler : saveAddress
}]
})]
}).show();
}
- extjs4 点击按钮出现tree,选择一个节点,显示到文本框
- 实现html中就一个按钮和一个文本框,点击按钮显示文本框,再点击文本框消失,再次点击又出现。
- 基于js的一个日历控件,点击按钮,弹出日历,显示日期到文本框
- 设计一个鼠标点击速度比赛游戏。 *(1)显示一个按钮和文本框。 *(2)文本框显示鼠标点击次数
- 利用Java Swing技术设计一个鼠标点击速度比赛游戏程序。程序显示一个按钮和一个文本框,用户点击按钮,文本框显示鼠标点击次数。
- 点击按钮出现文件选择
- 点击按钮复制粘贴到文本框
- /*设计一个鼠标点击速度比赛游戏。 *(1)显示一个按钮和文本框。 *(2)文本框显示鼠标点击次数*/ import javax.swing.*;//引用 import java.awt.*; i
- /*设计一个鼠标点击速度比赛游戏。 *(1)显示一个按钮和文本框。 *(2)文本框显示鼠标点击次数*/ import javax.swing.*;//引用 import java.awt.*; i
- 实现点击按钮后,一个文本框中的值复制到另一个中。
- 对于Extjs4中的tree无法显示根节点的问题
- 加法计算器 按钮变脸 文本框变脸 无刷新评论 高亮显示点击的当前行 网站选择
- C++.QT编程学习笔记——点击一个按钮后出现选择文件对话框
- 点击按钮弹出文本框
- android 点击一个按钮,选择一张图片,获取路径,然后显示在屏幕
- extjs4 tree 节点选中问题
- jquery treeview 点击文本框显示树全路径选择
- extjs4自动选择子节点。
- poj习题分类
- wireshark过滤基础知识
- 第七周第1天Java Web应用程序开发(一)
- 知识水滴
- 第七周第2天Java Web应用程序开发(二)
- extjs4 点击按钮出现tree,选择一个节点,显示到文本框
- SimpleDateFormat转换时间,12,24时间格式
- android中自定义checkbox大小和图片
- 《OpenGL编程基础》前言&第一章笔记
- Flash Builder4.6(SDK4.6)新的功能
- delphi xe编译报Unit not found: 'System.pas' or binary equivalents 的解决办法
- 需要知道的Applet基础知识
- 读书笔记_windows下的混合钩子(HOOK)_part 3_HookImportsOfImage函数解析
- C# 数据库中图像信息的读取与写入