extjs4 点击按钮出现tree,选择一个节点,显示到文本框
2011-10-11 21:02
555 查看
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();
}
相关文章推荐
- 实现html中就一个按钮和一个文本框,点击按钮显示文本框,再点击文本框消失,再次点击又出现。
- 设计一个鼠标点击速度比赛游戏。 *(1)显示一个按钮和文本框。 *(2)文本框显示鼠标点击次数
- 设计一个鼠标点击速度比赛游戏。 *(1)显示一个按钮和文本框。 *(2)文本框显示鼠标点击次数
- /*设计一个鼠标点击速度比赛游戏。 *(1)显示一个按钮和文本框。 *(2)文本框显示鼠标点击次数*/ import javax.swing.*;//引用 import java.awt.*; i
- android 点击一个按钮,选择一张图片,获取路径,然后显示在屏幕
- 利用Java Swing技术设计一个鼠标点击速度比赛游戏程序。程序显示一个按钮和一个文本框,用户点击按钮,文本框显示鼠标点击次数。两个人同时运行本程序,即可进行比赛
- 设计一个鼠标点击速度比赛游戏。 *(1)显示一个按钮和文本框。 *(2)文本框显示鼠标点击次数
- 窗口上提供四个文本框和一个按钮,幼儿可以在前三个文本框中输入两个运算数和运算符号,当点击按钮时在第四个文本框中显示结果。
- C++.QT编程学习笔记——点击一个按钮后出现选择文件对话框
- 利用Java Swing技术设计一个鼠标点击速度比赛游戏程序。程序显示一个按钮和一个文本框,用户点击按钮,文本框显示鼠标点击次数。
- /*设计一个鼠标点击速度比赛游戏。 *(1)显示一个按钮和文本框。 *(2)文本框显示鼠标点击次数*/ import javax.swing.*;//引用 import java.awt.*; i
- /*设计一个鼠标点击速度比赛游戏。 *(1)显示一个按钮和文本框。 *(2)文本框显示鼠标点击次数*/ import javax.swing.*;//引用 import java.awt.*; i
- /*设计一个鼠标点击速度比赛游戏。 *(1)显示一个按钮和文本框。 *(2)文本框显示鼠标点击次数*/ import javax.swing.*;//引用 import java.awt.*; i
- 题目:设计一个鼠标点击速度比赛游戏。 1)显示一个按钮和文本框。 2)文本框显示鼠标点击次数
- 设计一个鼠标点击速度比赛游戏。 (1)显示一个按钮和文本框。 (2)文本框显示鼠标点击次数
- /*设计一个鼠标点击速度比赛游戏。 *(1)显示一个按钮和文本框。 *(2)文本框显示鼠标点击次数*/ import javax.swing.*;//引用 import java.awt.*; i
- 在MFC中使用按下按钮出现选择文件对话框,选中一个指定文件,并将其地址显示到指定的编辑框中
- 加法计算器 按钮变脸 文本框变脸 无刷新评论 高亮显示点击的当前行 网站选择
- 用户在文本框中输入需要转换的十进制数,通过点击3个按钮在标签中显示结果。(点击一个实现一个)
- 弹出页面显示TreeView,点击节点(NavigateUrl)把选择的值赋给父窗体