本人是小白一个
想载页面加载时通过ajax查询数据库中的信息添加到表格中,但是dataTable的配置网上查了一大堆也没看明白,想请教下各位大牛。
这是前端的代码:
行政门户 查看
<div class="table-responsive">
<table id="sample-table-2" class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th class="center">
<label>
<input type="checkbox" class="ace" />
<span class="lbl"></span>
</label>
</th>
<th id="th">
姓名
</th>
<th>
部门
</th>
<th>
职务
</th>
<th>
分机号
</th>
<th>
联系电话
</th>
<th>
邮箱账号
</th>
<th>
入职时间
</th>
<th>
工作地点
</th>
<th>
员工状态
</th>
<th></th>
</tr>
</thead>
<tbody >
</tbody> //这里用来添加数据库的数据,与列一一对应
这里是js代码:
//有大牛可以分析下配置怎么写吗
var datatables = $('#sample-table-2').dataTable( {
"sAjaxSource":'http://localhost:8080/clientManager2/getEmployee.do',
"aoColumns": [
{ "bSortable": false },
null,null,null,null,null,null,null,null,null,
{ "bSortable": false }
] } );
这是 后台代码:
@RequestMapping(value="/getEmployee",method = RequestMethod.GET)
public @ResponseBody List getEmployee(){
List list = employeeService.getEmployee();
return list;
}
有大神可以救救小白我吗?(为了这个问题新注册的账号......暂时没有C币)