您的位置:首页 > 其它

Ext.grid.GridPanel中判断是否记录被选择(三种情况)

2012-03-31 16:41 197 查看
第一种:通过获得gridPanel中的Id(加入id为sysMenu_right)

var gp = Ext.getCmp('sysMenu_right').getSelectionModel();

var selected = gp.getSelected();//返回收割选择的记录

//判断有没有记录被选中.

if(selectM){

Ext.ux.Window().dialog({

title:'新增',

id:'sysMenu_funoptrefAdd',

width: 400,

height:160,

url:'sysMenu/funoptrefEdit.html?action=funoptrefAdd&funcId='+selectM.id});

}else{

MsgTip.show({msg : '请选择部门!',icon:MsgTip.TIP});

}

第二种:树形 通过获得gridPanel中的Id(加入id为sysMenu_right)

var gp = Ext.getCmp('sysMenu_right').getSelectionModel();
var selected = gp.getSelectedNode();

第三种:通过声明 var userPrivGrid = Ext.GridPanel()...
var selectionModel=userPrivGrid.getSelectionModel();

if(selectionModel.getCount()==1){

Ext.ux.Window().dialog({title:'修改',

id:'userPriv_update',

width: 380,

url:'userPriv/edit.html?action=update&privId='+selectionModel.getSelected().data.privId});

}else{

new Ext.ux.MsgTip({html : "请选择一笔数据!",icon:'icon-tip'});

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: