easyui 选中指定行

var rowindex=-1;//定义全局变量,选中行索引
$(function(){
	$('#housingGrid').datagrid({  
		//title : '编辑',  
		//iconCls : 'icon-ok',  
		//width : 200,  
		nowrap : true,//设置为true,当数据长度超出列宽时将会自动截取  
		striped : true,//设置为true将交替显示行背景。  
		collapsible : false,//显示可折叠按钮  
		url:'<%=basePath%>All.do',//url调用Action方法  
		loadMsg : '数据装载中......',  
		singleSelect:true,//为true时只能选择单行  
		fit : true,
		fitColumns:true,//允许表格自动缩放,以适应父容器  
		//sortName : 'xh',//当数据表格初始化时以哪一列来排序  
		//sortOrder : 'desc',//定义排序顺序,可以是'asc'或者'desc'(正序或者倒序)。  
		remoteSort : false,  
		 //frozenColumns : [ [ {  
		//    field : 'ck',  
		 //   checkbox : true  
		//} ] ],  
		pagination : true,//分页  
		pageSize : 15,//默认选择的分页是每页5行数据  
		pageList : [ 15, 20, 25, 30 ],//可以选择的分页集合  
		rownumbers : true,//行数
		onLoadSuccess:function(data){  
			 if(rowindex!=-1){
				 $('#housingGrid').datagrid('selectRow',rowindex);		
			}	//有选中行时加载数据后设置选中行
		},
		onClickRow:function(rowIndex,rowData){
			rowindex=$('#housingGrid').datagrid('getRowIndex', $("#housingGrid").datagrid('getSelected'));
		},//单击获得选中行索引
		onDblClickRow: function(rowIndex,rowData){
			//双击
		}
	});
});

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值