title:'模板列表',
iconCls:'icon-ok',
url:'${ctx }/userInfo/getAll.do',
nowrap: false,
striped: true,
collapsible:false,
fitColumns: true,
pagination:true,
singleSelect:true,
rownumbers:true,
remoteSort: false,
pageList:[3,5,10,50],
idField:'id',
columns:[[
{field:'username',title:'用户名',width:40,sortable:true},
{field:'realname',title:'姓名',width:30,sortable:true},
{field:'sex',title:'性别',width:20,sortable:true},
{field:'identitytype',title:'证件类型',width:30,sortable:true},
{field:'identitycode',title:'证件号码',width:40,sortable:true},
{field:'birthday',title:'生日',width:30,formatter:formatDatebox,sortable:true},
{field:'address',title:'地址',width:40,sortable:true},
{field:'state',title:'用户状态',width:30,sortable:true},
{field:'postcode',title:'邮编',width:40,sortable:true},
{field:'operate',title:'操作',width:20,formatter:formatOper,sortable:true}
]],
toolbar:[{
text:'修改',
iconCls:'icon-edit',
handler:function(){
editStorage();
}
},'-',{
text:'刷新',
iconCls:'icon-reload',
handler:function(){
$('#dataPageList').datagrid('reload');
}
}
],
onDblClickRow:function(){
dataItemTree();
}
});
});
添加操作列,进行用户冻结操作,从当前行获取当前行得值
function formatOper(value, row, index) { //value=当前点得单元格得值;row=当前行;index=索引
var str = "";
var row = $('#dataPageList').datagrid('getData').rows[index]; //获取选中行getData参数固定这么写,用row.state(state为那行对象的一个属性)取值
if(row.state=='已认证'){
str = '<a id="freeze'+index
+'" class="l-btn l-btn-plain" οnclick="deleteCate()" href="javascript:void(0)">'
+'<span class="l-btn-left">'
+'<span class="l-btn-text icon-add l-btn-icon-left">冻结</span>'
+'</span></a>';
}else if(row.state=='冻结'){
str = '<a id="thaw'+index+'" class="l-btn l-btn-plain" οnclick="thaw()" href="javascript:void(0)">'
+'<span class="l-btn-left">'
+'<span class="l-btn-text icon-remove l-btn-icon-left">解冻</span>'
+'</span></a>';
}
return str;
}