提问者:小点点

如何从请求Spring Boot转换dataTable


我正在学习编程,想使用数据表,我有一个问题。我不知道如何转换记录…

我在Spring靴里有代码

@RequestMapping(path="/seriess", method=RequestMethod.GET)
public Page<SeriesDao> showSeries(@RequestParam(defaultValue="0") int page)
{
    Page<SeriesDao> sss = seriesRepository.findAll(new PageRequest(page, 20));

    return sss;
}
@RequestMapping("/showSeries")
public ModelAndView model(){
    ModelAndView model = new ModelAndView("showSeries");
    return model;
}

接下来我去localhost:8080/seriess的时候有json,我没有复制所有的结果(20)

{"content":[{"id": 41,"name":"所有员工的平均每周收入:科珀斯克里斯蒂的私人总额,TX(MSA)","file":"SMU48185800500000011.csv","cassid":"1d2e556b-031e-4c6f-aec4-981c4e907324","分类id":3,"datefrom":"2006-12-31","dateto":"2016-09-30","频率":5,"标记":null,"单位":"每周$","提要":"Macroeconomic_And_Major_Markets","createdate":1476567529000,"changedate":1483919401000}………以及下一个19条记录]"last":false,"总计页面":25,"总计元素":488,"size":20,"number":0,"sort":null,"first":true,"numberOfElements":20}

这是我的java脚本代码。我必须纠正从url转换此数据,但我不知道如何…

$(document).ready( function () {
$('#dataTable').DataTable({
    "processing": true,
    "serverSide": true,
    "ajax": {
        "url": "seriess",
        "dataSrc" : ""
         }
    },
        "columns": [
            { "data": "id"},
            { "data": "name" },
            { "data": "file" },
            { "data": "cassid" },
            { "data": "categoryid" },
            { "data": "datefrom" },
            { "data": "dateto" },
            { "data": "frequency" },
            { "data": "markers" },
            { "data": "unit" },
            { "data": "feed" },
            { "data": "createdate" },
            { "data": "changedate" }
        ]
 })});

共1个答案

匿名用户

改变

"ajax": {
        "url": "seriess",
        "dataSrc" : ""
         }
    }

"ajax": {
        "url": "/seriess",
        "dataSrc" : "content"
         }
    }