日期:2014-05-16  浏览次数:20742 次

Ext gride 点击一行数据,获得这行数据的信息
我现在的需求是,选中一行数据,点击删除后,先弹窗显示选中这一行数据的信息,然后删除数据。点击一行数据数据,然后删除的功能我已经实现了,现在就是删除前,我不知道怎么获得选中这一行的数据信息,我用的是Ext4.0.7...... 

js 代码如下 

Ext.onReady(function(){ 
var itemsPerPage = 5;   // set the number of items you want per page 

var store = Ext.create('Ext.data.Store', { 
    id:'simpsonsStore', 
    autoLoad: false, 
    fields:['id', 'name', 'age'], 
    pageSize: itemsPerPage, // items per page 
    proxy: { 
        type: 'ajax', 
        url: 'info_getinfo.action',  // url that will load data with respect to start and limit params 
        reader: { 
            type: 'json', 
            root: 'list', 
            totalProperty: 'count' 
        } 
    } 
}); 

// specify segment of data you want to load using params 
store.load({ 
    params:{ 
        start:0, 
        limit: itemsPerPage 
    } 
}); 

var grid=Ext.create('Ext.grid.Panel', { 
    title: '用户信息', 
    store: store, 
    columns: [ 
        {header: '编号',  dataIndex: 'id'}, 
        {header: '姓名', dataIndex: 'name', flex:1}, 
        {header: '年龄', dataIndex: 'age'} 
    ], 
    width: 400, 
    height: 300, 
    dockedItems: [{ 
        xtype: 'pagingtoolbar', 
        store: store,   // same store GridPanel is using 
        dock: 'bottom', 
        displayInfo: true 
    },{ 
        xtype: 'toolbar', 
            items: [{ 
                text:'添加用户', 
                tooltip:'添加用户', 
                iconCls:'add' 
            }, '-', { 
              &n