extjs两个grid之间传值 50

左边和右边的grid之间有两个按钮,向左向右按钮左边grid里选择一行数据点击向右按钮,就跑到右边的grid里右边grid里选择一行数据点击向左按钮,就跑到左边的grid... 左边和右边的grid之间有两个按钮,向左向右按钮
左边grid里选择一行数据点击向右按钮,就跑到右边的grid里
右边grid里选择一行数据点击向左按钮,就跑到左边的grid里
求实例代码,原理都懂,就是写不出来,谢谢大神
展开
 我来答 举报
匿名用户
2015-01-26
展开全部
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<!DOCTYPE html>
<html lang="en_US">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title></title>
    <link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css">
    <script type="text/javascript" src="extjs/ext-all.js"></script>
      <script type="text/javascript">
      Ext.onReady(function(){
        var sampleData,
            store1,
            store2,
            grid1,
            grid2,
            clms;
 
        sampleData=[{
            userId:1,
            name:'Zeng'
        },{
            userId:2,
            name:'Lee'
        },{
            userId:3,
            name:'Chang'
        }];
 
        store1=Ext.create('Ext.data.Store',{
           fields:['userId','name'],
           data:sampleData
        });
           
        store2=Ext.create('Ext.data.Store',{
           fields:['userId','name']
        });
 
        clms=[{
            dataIndex:'userId',
            text:'User ID'
        },{
            dataIndex:'name',
            text:'Name'
        }];
 
        grid1=Ext.create('Ext.grid.Panel',{
            store:store1,
            columns:clms,
            flex:1,
            selType:'checkboxmodel'
        });
 
        grid2=Ext.create('Ext.grid.Panel',{
            store:store2,
            columns:clms,
            flex:1,
            selType:'checkboxmodel'
        });
 
 
        Ext.create('Ext.panel.Panel',{
            layout:{
                type:'hbox',
                align:'stretch'
            },
            width:420,
            height:300,
            items:[grid1,{
                xtype:'container',
                flex:0.3,
                items:[{
                    xtype:'button',
                    text:'>>',
                    itemId:'move_right',
                    handler:function(){
                        var records=grid1.getSelectionModel().getSelection();
                        store1.remove(records);
                        store2.add(records);
                    }
                },{
                    xtype:'button',
                    text:'<<',
                    itemId:'move_left',
                    handler:function(){
                        var records=grid2.getSelectionModel().getSelection();
                        store2.remove(records);
                        store1.add(records);
                    }
                }]
            },grid2],
            renderTo:Ext.getBody()
        });
    });
         
      </script>
  </head>
<body>
     
</body>
</html>



更多追问追答
追问
项目里不是用checkbox勾选的,是直接选中这一行,怎么改,谢谢
追答
much easier,把'selType'这个config项去除应该就可以,grid默认就是单行选择
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式