qq_32434675 2017-05-08 10:09 采纳率: 0%
浏览 4087

关于Bootstrap dataTable 往表格添加数据的问题

本人是小白一个
想载页面加载时通过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币)
  • 写回答

1条回答

  • Cool_Little 2017-05-08 12:25
    关注

    是要ajax异步加载数据吗?

    评论

报告相同问题?

悬赏问题

  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler