function getselect(){
var taskToPerson = $('#taskToPerson').val();
var taskToPersonname = $('#taskToPersonname').val();
createwindow1("添加","aeoMessageController.do?getSelect&taskToPerson="+taskToPerson+"&taskToPersonname="+taskToPersonname,800,600);
}
function createwindow1(title, addurl,width,height) {
width = width?width:700;
height = height?height:400;
if(width=="100%" || height=="100%"){
width = window.top.document.body.offsetWidth;
height =window.top.document.body.offsetHeight-100;
}
$.dialog({
content: 'url:'+addurl,
lock : true,
zIndex: getzIndex(),
width:width,
height:height,
title:title,
opacity : 0.3,
cache:false,
ok: function(){
debugger
iframe = this.iframe.contentWindow;
var ids = [];
var names = [];
var rows = iframe.$('#aeoMessageList').datagrid('getSelections');
for ( var i = 0; i < rows.length; i++) {
ids.push(rows[i].id);
names.push(rows[i].emp_Name);
}
$('#taskToPerson').val(ids.join(','));
$('#taskToPersonname').val(names.join(','));
},
});
}
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@include file="/context/mytags.jsp" %>
<%--非当前角色的用户列表--%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<div class="easyui-layout" fit="true">
<div region="center" style="padding:0px;border:0px">
<input id="taskToPerson" name="taskToPerson" type="hidden" value="${taskToPerson }">
<input id="taskToPersonname" name="taskToPersonname"type="hidden" value="${taskToPersonname }">
<t:datagrid name="aeoMessageList" title="添加记录" actionUrl="aeoMessageController.do?datagrid2" fit="true" fitColumns="true" pagination="true" showRefresh="false"
idField="id" checkbox="true" queryMode="group" onLoadSuccess="initCheck" >
<t:dgCol title="id" field="id" hidden="true" ></t:dgCol>
<t:dgCol title="人员" field="emp_Name" query="true"></t:dgCol>
<t:dgCol title="部门" field="emp_orgname" width="100" ></t:dgCol>
</t:datagrid>
</div>
</div>
<script>
function initCheck(data){
var ids =$('#taskToPerson').val();
var idArr = ids.split(",");
for(var i=0;i<idArr.length;i++){
if(idArr[i]!=""){
$("#aeoMessageList").datagrid("selectRecord",idArr[i]);
}
}
}
$(document).ready(function(){
});
</script>