easyui selectRecord 选中行

 

1) 表格datagrid 

只要加入idField = "id" 刷新后依然是选中状态

 <table id="dg001" class="easyui-datagrid" toolbar="#dg001Toolbar"
             width="100%"
             url="${ctx}/admin/rechargeReview/listData" idField="id" pagination="true"
             data-options="checkOnSelect:true"
            rownumbers="true" fitColumns="true" singleSelect="true">
	        <thead>
	            <tr>
	                <th field="id" data-options="checkbox:true"></th>
					<th field="mobileNo" width="150">手机号 </th>
					<th field="tname" width="150">用户姓名</th>
					<th field="account" width="150">支付宝账号</th>
					<th field="tradeNo" width="150">交易号</th>
					<th field="money" width="150">充值表单金额</th>
					<th field="addtime" width="150">提交时间</th>
					<th field="actualMoney" width="150">实际到账金额 </th>
					<th field="status" width="150">充值状态 </th>
					<th field="oktime" width="150">充值时间</th>
	            </tr>
	        </thead>
        </table>

 

 

js 内容

 

setInterval("reloadData()",1000 * 5);
  function reloadData(){
	  var rows001 = $("#dg001").datagrid('getSelections');
	  if (rows001 && rows001.length > 0) {
	      $("#dg001").datagrid("selectRecord",rows001[0].id);
	  }
	  $("#dg001").datagrid('reload');
	  
	  var rows002 = $("#dg002").datagrid('getSelections');
	  if (rows002 && rows002.length > 0) {
		  $("#dg002").datagrid("selectRecord",rows002[0].id);
	  }
	  $("#dg002").datagrid('reload');
  };

 

 

 

 

你可能感兴趣的:(easyui)