Bootgrid分页和搜索无法正常工作

时间:2015-01-21 03:22:56

标签: javascript pagination

我正在尝试使用bootgrid从json获取数据,数据可以显示为网格,但其分页和搜索不起作用。我试图调试,但没有显示错误。

  $(document).ready(function(){
    $("#grid-command-buttons").bootgrid(
    {
            ajax: true,
            url: "/newspider/test.do",
            post: function (data)
            {
            },
        });
})

这是我的servlet

    public void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    request.setCharacterEncoding("utf-8"); // 设置编码  
    response.setCharacterEncoding("utf-8");  
    response.setContentType("text/html;charset=UTF-8");
    PrintWriter out = response.getWriter();
    SqlSession sqlSession = getSessionFactory().openSession();
    UserMapper userMapper = sqlSession.getMapper(UserMapper.class);
    JSONObject jsonObject = new JSONObject();
    jsonObject.put("current", 1);
    jsonObject.put("rowCount", 10);
    JSONArray rows = new JSONArray();       
    List<ResumeShow> si = userMapper.selectRShow();
    int cont=si.size();
    int cnt=1;      
    for (ResumeShow resumeShow : si) {
        JSONObject cell = new JSONObject();
        cell.put("id", cnt++);
        cell.put("seeker_name", resumeShow.getSeeker_name());
        cell.put("sex", resumeShow.getSex());
        cell.put("age", resumeShow.getAge());
        cell.put("residence", resumeShow.getResidence());
        cell.put("education", resumeShow.getEducation());
        cell.put("profession", resumeShow.getProfession());
        cell.put("school", resumeShow.getSchool());
        cell.put("expect_salary", resumeShow.getExpect_salary());
        cell.put("work_place", resumeShow.getWork_place());
        cell.put("last_company", resumeShow.getLast_company());
        cell.put("position_name", resumeShow.getPosition_name());
        cell.put("last_period", resumeShow.getLast_period());
        cell.put("workYears", resumeShow.getWorkYears());
        cell.put("household_registration", resumeShow.getHousehold_registration());
        cell.put("job_category", resumeShow.getJob_category());
        rows.add(cell);
    }
    jsonObject.put("rows", rows);
    jsonObject.put("total", cont);
    out.print(jsonObject);
}

有人知道发生了什么事吗?提前感谢。

0 个答案:

没有答案