Use PageRequest in Spring Boot how use to show data ?

Use PageRequest in Spring Boot how use to show data ?

testniktestnik Posts: 1Questions: 0Answers: 0

Maybe the name this topic is wrong.

I'm a new user, and I'm learning DataTables.

In Spring Boot i have this request ...
'''
@RequestMapping(path="/showData", method=RequestMethod.GET)
public Page<SeriesDao> showSeries(@RequestParam(defaultValue="0") int page)
{
Page<SeriesDao> sss = seriesRepository.findAll(new PageRequest(page, 20));

    return sss;
}

'''
respons from this it's look like:
'''
{"content":[{"id":41,"name":"Average Weekly Earnings of All Employees: Total Private in Corpus Christi, TX (MSA)","file":"SMU48185800500000011.csv","cassid":"1d2e556b-031e-4c6f-aec4-981c4e907324","categoryid":3,"datefrom":"2006-12-31","dateto":"2016-09-30","frequency":5,"markers":null,"unit":"$ per Week","feed":"Macroeconomic_And_Major_Markets","createdate":1476567529000,"changedate":1483919401000},..........and next 24 records],

"last":false,"totalPages":25,"totalElements":488,"size":20,"number":0,"sort":null,"first":true,"numberOfElements":20}

'''

Next i have script:
'''
$(document).ready( function () {
$('#dataTable').DataTable({
"processing": true,
"serverSide": true,
"ajax": {
"url": "showData",
"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" }
]
})
});'''

I must convert the recrods form /showData

This discussion has been closed.