easyui-datagrid url 调用action 数据在table中不显示
action :
public String list() {
try {
List<UserBean> ulist = userService.getAllUser();
Map<String, Object> map=new HashMap<String, Object>();
map.put("total",new Integer(ulist.size()));
map.put("rows",ulist);
JSONArray json = JSONArray.fromObject(map);
dataString = json.toString();
dataString = dataString.substring(1, dataString.length()-1);
log.info("dataString: "+dataString);
return SUCCESS;
} catch (Exception e) {
log.error("----------error----------", e);
return "error";
}
}
<action name="listUser" class="com.myssh.demo.action.UserAction" method="list">
<result name="success" type="json" >
<param name="root">dataString</param>
</result>
<result name="error">/WEB-INF/jsp/error.jsp</result>
</action>
<table id="mydatagrid" class="easyui-datagrid" title="DataGrid Complex Toolbar" style="width:700px;height:250px"
data-options="rownumbers:true,singleSelect:true,url:'<c:url value="userinfo/listUser"/>',
method:'get',toolbar:'#tb',loadFilter: function(data){ alert(data); }">
<thead>
<tr>
<th data-options="field:'id',width:80">id</th>
<th data-options="field:'name',width:100">name</th>
<th data-options="field:'password',width:80,align:'right'">password</th>
</tr>
</thead>
</table>
$("#buttonGrid").datagrid({
url:appPath+'/page/button/buttonlist',
height : 550,
striped: true,
remoteSort:false,
queryParams: getQueryParam(),
idField:'buttonCode',
checkbox:true,
frozenColumns:[[
{field:'ck',checkbox:true},
{field:'opt',title:'操作',width:32,align:'center',
formatter:function(value,rowData,rowIndex){
var dataStr = JSON.stringify(rowData);
return "<img class='op-enable' src='"+appPath+"/js/lib/jquery-easyui/themes/icons/pencil.png' title='编辑' onClick='showEdit("+dataStr+")'/>";
}
}
]],
columns:[[
{field:'buttonCode',title:'按钮编码',width:100,align:'left',sortable:true},
{field:'buttonName',title:'按钮名称',width:100,align:'left',sortable:true},
{field:'buttonType',title:'按钮类型',width:100,align:'left',sortable:true},
{field:'username',title:'添加人',width:100,align:'left',sortable:true},
{field:'addTimeString',title:'添加时间',width:200,align:'left',sortable:true},
{field:'editTimeString',title:'修改时间',width:200,align:'left',sortable:true},
{field:'isDelete',title:'是否删除',width:400,align:'left',sortable:true}
]],