右键删除选中的行总提示rowIndex

var data=[
                {header:'类型',dataIndex:'TRTY',name:'TRTY',renderer:prst},
                {header:'地址',dataIndex:'TRMA',name:'TRMA'},
                {header:'IP地址',dataIndex:'TRIP',name:'TRIP'},
                {header:'告警,dataIndex:'TRER',name:'TRER',renderer:pctChange},
                {header:'时间',dataIndex:'TRDA',name:'TRDA'},
                {header:'设备名称',dataIndex:'TRNA',name:'TRNA'},                  
                {header:'所在区域',dataIndex:'DLAR',name:'DLAR',hidden:true},
                {header:'所在小区',dataIndex:'DLFR',name:'DLFR'},
                {header:'所在街',dataIndex:'DLSE',name:'DLSE',hidden:true}          
                              
            ];

var store1=new Ext.data.GroupingStore({
            proxy:new Ext.data.HttpProxy({url:'../pro/INDEX.aspx?cmd=url'}),
             reader:new Ext.data.JsonReader({root:"result",totalProperty:"totalPorperty"},data),
            groupField:'TRER',
            sortInfo:{field:'TRDA',direction:'desc'}
        });

var grid= new Ext.grid.GridPanel({
            width:790,
            height:400,
            border:false,
            columns:data,
            sm:new Ext.grid.RowSelectionModel({singleSelect:true}),
            view:new Ext.grid.GroupingView({startCollapsed:false}),
            store:store1           
                
        });
        var contextmenu=new Ext.menu.Menu({                                      
                                       items:[{ 
                                            text:'删除',
                                           pressed:true,
                                            handler:function(){ Edit(grid,rowIndex,e);

                                                              }
                                                  }]
                                           }); 
                                    

grid.on("rowcontextmenu",function(grid,rowIndex,e){
                                                 e.preventDefault(); 
                                                contextmenu.showAt(e.getPoint());

                                                                                       }
                                           );

            function Edit(grid,rowIndex,e)
     {  var record = grid.getStore().getAt(rowIndex);

         var name=record.data.name;
        
             }

posted @ 2012-01-11 10:02  左正  阅读(325)  评论(0编辑  收藏  举报