EXT2.0 窗口树双栏多选_代码

预览:
005.jpg

代码:

None.gif Ext.BLANK_IMAGE_URL  =   ' js/ext-2.0/resources/images/default/s.gif ' ;
None.gif
ExpandedBlockStart.gifContractedBlock.gifExt.onReady(
function ()  dot.gif {
InBlock.gif
InBlock.gif    Ext.QuickTips.init();
InBlock.gif    Ext.form.Field.prototype.msgTarget 
= 'side';
InBlock.gif
InBlock.gif    
var items = [["123""中华人民共和国"], ["1""江苏省"], ["2""浙江省"], ["3""广东省"],
InBlock.gif            [
"4""四川省"], ["5""湖北省"], ["6""湖南省"], ["7""贵州省"],
InBlock.gif            [
"8""江西省"], ["9""辽宁省"]];
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
var store = new Ext.data.SimpleStore(dot.gif{
InBlock.gif        fields : [
"id_p""nombre"],
InBlock.gif        data : items
InBlock.gif
ExpandedSubBlockEnd.gif    }
);
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
var itemSelI = dot.gif{
InBlock.gif        xtype : 
"itemselector",
InBlock.gif        name : 
"itemselector",
InBlock.gif        fieldLabel : 
"双栏选框",
InBlock.gif        dataFields : [
"id_p""nombre"],
InBlock.gif        fromStore : store,
InBlock.gif        toData : [
"9""辽宁省"],
InBlock.gif        msWidth : 
180,
InBlock.gif        autoScroll : 
true,
InBlock.gif        msHeight : 
250,
InBlock.gif        valueField : 
"id_p",
InBlock.gif        displayField : 
"nombre",
InBlock.gif        
// imagePath:"ext-ux/multiselect",
InBlock.gif
        // switchToFrom:true,
InBlock.gif
        toLegend : "已选栏",
InBlock.gif        fromLegend : 
"可选栏",
ExpandedSubBlockStart.gifContractedSubBlock.gif        toTBar : [
dot.gif{
InBlock.gif            text : 
"取消选择",
ExpandedSubBlockStart.gifContractedSubBlock.gif            handler : 
function() dot.gif{
InBlock.gif                
var i = formItemSelector.getForm().findField("itemselector");
InBlock.gif                i.reset.call(i);
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }
]
ExpandedSubBlockEnd.gif    }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
var formItemSelector = new Ext.form.FormPanel(dot.gif{
InBlock.gif        labelWidth : 
75,
InBlock.gif        width : 
700,
InBlock.gif        baseCls : 
'x-plain',
InBlock.gif        layout : 
'absolute',
InBlock.gif        items : [itemSelI]
ExpandedSubBlockEnd.gif    }
);
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
var tree = new Ext.tree.TreePanel(dot.gif{
InBlock.gif
InBlock.gif        animate : 
true,
InBlock.gif        enableDD : 
true,
InBlock.gif        containerScroll : 
true,
InBlock.gif        ddGroup : 
'organizerDD',
InBlock.gif        rootVisible : 
true,
InBlock.gif        region : 
'west',
InBlock.gif        width : 
150,
InBlock.gif        split : 
true,
InBlock.gif        autoScroll : 
true,
InBlock.gif        collapseMode : 
'mini',
InBlock.gif        border : 
false,
InBlock.gif        
// margins: '5 0 5 5',
ExpandedSubBlockStart.gifContractedSubBlock.gif
        loader : new Ext.tree.TreeLoader(dot.gif{
InBlock.gif            dataUrl : 
'addressBook.do?dispatch=queryAddressBook'
ExpandedSubBlockEnd.gif        }
)
ExpandedSubBlockEnd.gif    }
);
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
var root = new Ext.tree.AsyncTreeNode(dot.gif{
InBlock.gif        text : 
'通讯录',
InBlock.gif        draggable : 
false,
InBlock.gif        id : 
'1'
ExpandedSubBlockEnd.gif    }
);
InBlock.gif
InBlock.gif    tree.setRootNode(root);
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    tree.on(
'click'function(node) dot.gif{
InBlock.gif        store.loadData([[
"1""江苏省"], ["2""浙江省"], ["3""广东省"]]);
InBlock.gif
ExpandedSubBlockEnd.gif    }
);
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
var itlayout = new Ext.Panel(dot.gif{
InBlock.gif        id : 
'images',
InBlock.gif        region : 
'center',
InBlock.gif        bodyStyle : 
'background:white;padding:5px;',
InBlock.gif        border : 
false,
InBlock.gif        layout : 
'fit',
InBlock.gif
InBlock.gif        items : formItemSelector
ExpandedSubBlockEnd.gif    }
);
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
var tritlayout = new Ext.Panel(dot.gif{
InBlock.gif        layout : 
'border',
InBlock.gif        border : 
true,
InBlock.gif        items : [tree, itlayout]
ExpandedSubBlockEnd.gif    }
);
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
var windowconfig = dot.gif{
InBlock.gif        title : 
'测试',
InBlock.gif        width : 
575,
InBlock.gif        height : 
350,
InBlock.gif        autoScroll : 
true,
InBlock.gif        bodyStyle : 
'background:white;padding:5px;',
InBlock.gif        layout : 
'fit',
InBlock.gif        items : [tritlayout],
ExpandedSubBlockStart.gifContractedSubBlock.gif        buttons : [
dot.gif{
InBlock.gif            text : 
"取值",
ExpandedSubBlockStart.gifContractedSubBlock.gif            handler : 
function() dot.gif{
InBlock.gif                alert(formItemSelector.getForm().getValues(
true));
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }
]
ExpandedSubBlockEnd.gif    }

InBlock.gif    
var window = new Ext.Window(windowconfig);
InBlock.gif    window.show();
InBlock.gif
ExpandedBlockEnd.gif}
);

Data Store版本:

json数据 itemstore.json :

ExpandedBlockStart.gif ContractedBlock.gif dot.gif {
ExpandedSubBlockStart.gifContractedSubBlock.gif        
"results" : [dot.gif{
InBlock.gif            
"id_p" : "3",
InBlock.gif            
"nombre" : "asdf"
ExpandedSubBlockStart.gifContractedSubBlock.gif        }
dot.gif{
InBlock.gif            
"id_p" : "1",
InBlock.gif            
"nombre" : "Federico"
ExpandedSubBlockStart.gifContractedSubBlock.gif        }
dot.gif{
InBlock.gif            
"id_p" : "2",
InBlock.gif            
"nombre" : "jose luis"
ExpandedSubBlockStart.gifContractedSubBlock.gif        }
dot.gif{
InBlock.gif            
"id_p" : "6",
InBlock.gif            
"nombre" : "migueld"
ExpandedSubBlockStart.gifContractedSubBlock.gif        }
dot.gif{
InBlock.gif            
"id_p" : "5",
InBlock.gif            
"nombre" : "nacho"
ExpandedSubBlockStart.gifContractedSubBlock.gif        }
dot.gif{
InBlock.gif            
"id_p" : "4",
InBlock.gif            
"nombre" : "tuetye"
ExpandedSubBlockEnd.gif        }
],
InBlock.gif        
"total" : 6
ExpandedBlockEnd.gif    }


代码:

None.gif Ext.BLANK_IMAGE_URL  =   ' js/ext-2.0/resources/images/default/s.gif ' ;
None.gif
ExpandedBlockStart.gifContractedBlock.gifExt.onReady(
function ()  dot.gif {
InBlock.gif
InBlock.gif    Ext.QuickTips.init();
InBlock.gif    Ext.form.Field.prototype.msgTarget 
= 'side';
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
var ds_addr = new Ext.data.Store(dot.gif{
InBlock.gif        autoLoad : 
true,
InBlock.gif        url : 
'itemstore.json',
ExpandedSubBlockStart.gifContractedSubBlock.gif        reader : 
new Ext.data.JsonReader(dot.gif{
InBlock.gif            id : 
'id_p',
InBlock.gif            root : 
'results',
InBlock.gif            totalProperty : 
'total'
ExpandedSubBlockStart.gifContractedSubBlock.gif        }
, [dot.gif{
InBlock.gif            name : 
'id_p'
ExpandedSubBlockStart.gifContractedSubBlock.gif        }
dot.gif{
InBlock.gif            name : 
'nombre'
ExpandedSubBlockEnd.gif        }
,])
ExpandedSubBlockEnd.gif    }
);
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
var itemSelI = dot.gif{
InBlock.gif        xtype : 
"itemselector",
InBlock.gif        name : 
"itemselector",
InBlock.gif        fieldLabel : 
"双栏选框",
InBlock.gif        dataFields : [
"id_p""nombre"],
InBlock.gif        fromStore : ds_addr,
InBlock.gif        toData : [
"9""辽宁省"],
InBlock.gif        msWidth : 
180,
InBlock.gif        autoScroll : 
true,
InBlock.gif        msHeight : 
250,
InBlock.gif        valueField : 
"id_p",
InBlock.gif        displayField : 
"nombre",
InBlock.gif        
// imagePath:"ext-ux/multiselect",
InBlock.gif
        // switchToFrom:true,
InBlock.gif
        toLegend : "已选栏",
InBlock.gif        fromLegend : 
"可选栏",
ExpandedSubBlockStart.gifContractedSubBlock.gif        toTBar : [
dot.gif{
InBlock.gif            text : 
"取消选择",
ExpandedSubBlockStart.gifContractedSubBlock.gif            handler : 
function() dot.gif{
InBlock.gif                
var i = formItemSelector.getForm().findField("itemselector");
InBlock.gif                i.reset.call(i);
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }
]
ExpandedSubBlockEnd.gif    }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
var formItemSelector = new Ext.form.FormPanel(dot.gif{
InBlock.gif        labelWidth : 
75,
InBlock.gif        width : 
700,
InBlock.gif        baseCls : 
'x-plain',
InBlock.gif        layout : 
'absolute',
InBlock.gif        items : [itemSelI]
ExpandedSubBlockEnd.gif    }
);
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
var tree = new Ext.tree.TreePanel(dot.gif{
InBlock.gif
InBlock.gif        animate : 
true,
InBlock.gif        enableDD : 
true,
InBlock.gif        containerScroll : 
true,
InBlock.gif        ddGroup : 
'organizerDD',
InBlock.gif        rootVisible : 
true,
InBlock.gif        region : 
'west',
InBlock.gif        width : 
150,
InBlock.gif        split : 
true,
InBlock.gif        autoScroll : 
true,
InBlock.gif        collapseMode : 
'mini',
InBlock.gif        border : 
false,
InBlock.gif        
// margins: '5 0 5 5',
ExpandedSubBlockStart.gifContractedSubBlock.gif
        loader : new Ext.tree.TreeLoader(dot.gif{
InBlock.gif            dataUrl : 
'addressBook.do?dispatch=queryAddressBook'
ExpandedSubBlockEnd.gif        }
)
ExpandedSubBlockEnd.gif    }
);
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
var root = new Ext.tree.AsyncTreeNode(dot.gif{
InBlock.gif        text : 
'通讯录',
InBlock.gif        draggable : 
false,
InBlock.gif        id : 
'1'
ExpandedSubBlockEnd.gif    }
);
InBlock.gif
InBlock.gif    tree.setRootNode(root);
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    tree.on(
'click'function(node) dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif        ds_addr.load(
dot.gif{params:dot.gif{index:''+node}});  
ExpandedSubBlockEnd.gif    }
);
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
var itlayout = new Ext.Panel(dot.gif{
InBlock.gif        id : 
'images',
InBlock.gif        region : 
'center',
InBlock.gif        bodyStyle : 
'background:white;padding:5px;',
InBlock.gif        border : 
false,
InBlock.gif        layout : 
'fit',
InBlock.gif
InBlock.gif        items : formItemSelector
ExpandedSubBlockEnd.gif    }
);
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
var tritlayout = new Ext.Panel(dot.gif{
InBlock.gif        layout : 
'border',
InBlock.gif        border : 
true,
InBlock.gif        items : [tree, itlayout]
ExpandedSubBlockEnd.gif    }
);
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
var windowconfig = dot.gif{
InBlock.gif        title : 
'测试',
InBlock.gif        width : 
575,
InBlock.gif        height : 
350,
InBlock.gif        autoScroll : 
true,
InBlock.gif        bodyStyle : 
'background:white;padding:5px;',
InBlock.gif        layout : 
'fit',
InBlock.gif        items : [tritlayout],
ExpandedSubBlockStart.gifContractedSubBlock.gif        buttons : [
dot.gif{
InBlock.gif            text : 
"取值",
ExpandedSubBlockStart.gifContractedSubBlock.gif            handler : 
function() dot.gif{
InBlock.gif                alert(formItemSelector.getForm().getValues(
true));
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }
]
ExpandedSubBlockEnd.gif    }

InBlock.gif    
var window = new Ext.Window(windowconfig);
InBlock.gif    window.show();
InBlock.gif
ExpandedBlockEnd.gif}
);



下载地址:

http://cn.ziddu.com/download.php?uid=crGempyncrCh4palabKWlJqiaaygnJc%3D9

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值