<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head >
$(document).ready(function () {
BinDingGride1();
BinDingGride2();
GetUser();
});
function SelectToRight() {
var row = $('#Gride1').datagrid('getSelected');
if (row) {
toright(row);
}
}
function SelectAllToRight() {
var grides = $('#Gride1').datagrid('getRows');
$(grides).each(function () {
toright(this);
});
}
function SelectToLeft() {
var row = $('#Gride2').datagrid('getSelected');
if (row) {
toleft(row);
}
}
function SelectAllToLeft() {
var grides = $('#Gride2').datagrid('getRows');
$(grides).each(function () {
toleft(this);
});
}
function toright(row) {
if (row) {
var index = $('#Gride1').datagrid('getRowIndex', row);
$('#Gride1').datagrid('deleteRow', index);
}
var lastIndex;
$('#Gride2').datagrid('appendRow', {
JUESEMC: row.JUESEMC,
JUESEID: row.JUESEID
});
lastIndex = $('#Gride2').datagrid('getRows').length - 1;
$('#Gride2').datagrid('selectRow', lastIndex);
}
function toleft(row) {
if (row) {
var index = $('#Gride2').datagrid('getRowIndex', row);
$('#Gride2').datagrid('deleteRow', index);
}
var lastIndex;
$('#Gride1').datagrid('appendRow', {
JUESEMC: row.JUESEMC,
JUESEID: row.JUESEID
});
lastIndex = $('#Gride1').datagrid('getRows').length - 1;
$('#Gride1').datagrid('selectRow', lastIndex);
}
//绑定数据到用户列表
function BinDingGride1() {
$('#Gride1').datagrid({
width: 200,
height: 350,
url: 'GY_YONGHUJSList.aspx?action=getlist1&timeid=' + Math.random() + '',
method: "GET",
singleSelect: true
});
}
//绑定数据到用户列表
function BinDingGride2() {
var uid = '<%=Uid %>';
$('#Gride2').datagrid({
width: 200,
height: 350,
url: 'GY_YONGHUJSList.aspx?id=' + uid + '&action=getlist2&timeid=' + Math.random() + '',
method: "GET",
singleSelect: true
});
}
function GetUser() {
var uid = '<%=Uid %>';
$.ajax({
type: "POST", //必须要用POST
url: "GY_YONGHUJSList.aspx/GetUser",
data: "{uid:" + uid + "}", //data必须和contentType同时出现,如果没有参数传入,就算给个空值也要写的。如:data: "{}",
contentType: "application/json; charset=utf-8;", //这个也是必须的
dataType: "json",
async: false, //同步请求,设为false将会锁住浏览器
success: function (result) {
$("#span_yonghuming").html(result.d);
},
error: function (x, textStatus) {
alert(x.responseText);
}
});
}
</script>
</form>
</body>
</html>