datagrid = $(
"#dgrid"
).datagrid({
url:
'../AccountAction/Account.ashx?'
,
//加载的URL
iconCls:
"icon-save"
,
//图标
title:
"帐号管理"
,
loadMsg:
"正在加载数据,请稍等..."
,
idField:
"ID"
,
pagination:
true
,
//显示分页
pageSize: 10,
//分页大小
pageList: [5, 10, 15, 20],
//每页的个数
fit:
true
,
//自动补全
fitColumns:
true
,
queryParams: queryParams,
rownumbers:
true
,
//显示行号
singleSelect:
true
,
columns: column,
view: detailview,
detailFormatter:
function
(index, row) {
return
'<div style="padding:2px"><table class="ddv"></table></div>'
;
},
onExpandRow:
function
(index, row) {
var
ddv = $(
this
).datagrid(
'getRowDetail'
, index).find(
'table.ddv'
);
ddv.datagrid({
url:
'../AccountAction/DisplayNumberHandler.ashx'
,
fitColumns:
true
,
singleSelect:
false
,
rownumbers:
true
,
loadMsg:
'正在加载数据,请稍等...'
,
height:
'auto'
,
columns: [[
{field:
'ck'
,checkbox:
true
},
{ field:
'PHONE'
, title:
'号码'
, align:
"center"
, width: 60 },
{ field:
'APPID'
, title:
'ID'
, align:
"center"
, width: 100 },
{
field:
'提交'
, title:
'提交'
, align:
"center"
, width: 100, formatter:
function
(value, rowData, rowIndex) {
return
"<a class=\"l-btn l-btn-small l-btn-plain\" style=\"color:blue\" onclick=\"QueryAppState('"
+ value +
"','"
+ rowData.APPNAME +
"');\"><span class=\"l-btn-left l-btn-icon-left\"><span class=\"l-btn-text\">"
+
"申请"
+
"</span><span class=\"l-btn-icon icon-edit\"></span></span></a>"
;
}
}
]],
onResize:
function
() {
$(
'#dg'
).datagrid(
'fixDetailRowHeight'
, index);
},
onLoadSuccess:
function
() {
setTimeout(
function
() {
$(
'#dg'
).datagrid(
'fixDetailRowHeight'
, index);
}, 0);
}
,
toolbar: [
//工具条
{
text:
"批量删除"
, iconCls:
"icon-add"
, handler:
function
() {
//回调函数
var
rows = datagrid.datagrid(
'getSelections'
);
if
(rows.length <= 0) {
$.messager.alert(
'警告'
,
'您没有选择'
,
'error'
);
}
//AddAccount();
}
}
]
});
$(
'#dg'
).datagrid(
'fixDetailRowHeight'
, index);
},
toolbar: [
//工具条
{
text:
"号码"
, iconCls:
"icon-upload"
, handler:
function
() {
//回调函数
var
rows = datagrid.datagrid(
'getSelections'
);
if
(rows.length <= 0) {
$.messager.alert(
'警告'
,
'您没有选择'
,
'error'
);
}
UploadCommitmentLetter();
}
}
]
});
- getSelected:取得第一个选中行数据,如果没有选中行,则返回 null,否则返回记录。