I tried a lot of things which i can do everything. pagenation is not working!! please help me!!

I tried a lot of things which i can do everything. pagenation is not working!! please help me!!

맹호진맹호진 Posts: 1Questions: 1Answers: 0

below is my script code
http://ottbang.com/image/source1.PNG

$(document).ready( function() { $('#datatable_ajax').dataTable( { "lengthMenu": [ [15, 30, 50, -1], [15, 30, 50, "All"] // change per page values here ], "pageLength": 15, "processing": true, "serverSide": true, /* "deferLoading": "${orderDtosCount}", */ "ajax": "<%=request.getContextPath()%>/order/list2", "columns": [ { "data": "mNo" }, { "data": "mContact" }, { "data": "mOrderNumber" }, { "data": "mOrderPrice" }, { "data": "mOrderDate" }, { "data": "mOrderType" } ] }); } )

and then i returend ajax data like below
i denfenately added
recordFiltered,recordsTotal,draw,data
like http://datatables.net/examples/server_side/object_data.html

http://ottbang.com/image/situation3.png
ㄴ{
"result": true,
"recordsFiltered": 374,
"data": [{
"mOrderDate": "2016-02-22 23:56:33.0",
"mOrderNumber": "12312312",
"mOrderPrice": "10000",
"mOrderType": "무통장",
"mContact": "010-7578-1839",
"mNo": 0
}, {
"mOrderDate": "2016-02-22 23:56:33.0",
"mOrderNumber": "12312312",
"mOrderPrice": "10000",
"mOrderType": "무통장",
"mContact": "010-7578-1839",
"mNo": 1
}, {
"mOrderDate": "2016-02-22 23:56:33.0",
"mOrderNumber": "12312312",
"mOrderPrice": "10000",
"mOrderType": "무통장",
"mContact": "010-7578-1839",
"mNo": 2
}, {
"mOrderDate": "2016-02-22 23:56:33.0",
"mOrderNumber": "12312312",
"mOrderPrice": "10000",
"mOrderType": "무통장",
"mContact": "010-7578-1839",
"mNo": 3
}, {
"mOrderDate": "2016-02-22 23:56:33.0",
"mOrderNumber": "12312312",
"mOrderPrice": "10000",
"mOrderType": "무통장",
"mContact": "010-7578-1839",
"mNo": 4
}, {
"mOrderDate": "2016-02-22 23:56:33.0",
"mOrderNumber": "12312312",
"mOrderPrice": "10000",
"mOrderType": "무통장",
"mContact": "010-7578-1839",
"mNo": 5
}, {
"mOrderDate": "2016-02-22 23:56:33.0",
"mOrderNumber": "12312312",
"mOrderPrice": "10000",
"mOrderType": "무통장",
"mContact": "010-7578-1839",
"mNo": 6
}, {
"mOrderDate": "2016-02-22 23:56:33.0",
"mOrderNumber": "12312312",
"mOrderPrice": "10000",
"mOrderType": "무통장",
"mContact": "010-7578-1839",
"mNo": 7
}, {
"mOrderDate": "2016-02-22 23:56:33.0",
"mOrderNumber": "12312312",
"mOrderPrice": "10000",
"mOrderType": "무통장",
"mContact": "010-7578-1839",
"mNo": 8
}, {
"mOrderDate": "2016-02-22 23:56:33.0",
"mOrderNumber": "12312312",
"mOrderPrice": "10000",
"mOrderType": "무통장",
"mContact": "010-7578-1839",
"mNo": 9
}, {
"mOrderDate": "2016-02-22 23:56:32.0",
"mOrderNumber": "12312312",
"mOrderPrice": "10000",
"mOrderType": "무통장",
"mContact": "010-7578-1839",
"mNo": 10
}, {
"mOrderDate": "2016-02-22 23:56:32.0",
"mOrderNumber": "12312312",
"mOrderPrice": "10000",
"mOrderType": "무통장",
"mContact": "010-7578-1839",
"mNo": 11
}, {
"mOrderDate": "2016-02-22 23:56:32.0",
"mOrderNumber": "12312312",
"mOrderPrice": "10000",
"mOrderType": "무통장",
"mContact": "010-7578-1839",
"mNo": 12
}, {
"mOrderDate": "2016-02-22 23:56:32.0",
"mOrderNumber": "12312312",
"mOrderPrice": "10000",
"mOrderType": "무통장",
"mContact": "010-7578-1839",
"mNo": 13
}, {
"mOrderDate": "2016-02-22 23:56:32.0",
"mOrderNumber": "12312312",
"mOrderPrice": "10000",
"mOrderType": "무통장",
"mContact": "010-7578-1839",
"mNo": 14
}],
"orderCount": 374,
"draw": 1,
"recordsTotal": 374,
"resultMsg": "성공적으로 주문 데이터를 가져왔습니다."
}

and then 2 problems occured

1.fist always Showing 0 to 0 of 0 entries.
2.second pagination [1],[2],[3],[4],[5] dosen't see
http://ottbang.com/image/situation1.png

but, when i add option which is deferLoading in script
i can see pagination but data not seen like below.
http://ottbang.com/image/situation2.png

please help me ㅠ..ㅠ

Answers

  • xxiaccxxiacc Posts: 1Questions: 0Answers: 0

    ME, TOO :)

  • loloskiloloski Posts: 46Questions: 5Answers: 1

    all I can say is check first if your server side language properly set the response header whether your server is return the proper content-type which is application/json; charset=utf8

    that's a good start to troubleshoot your issue because the content-type might be set with text/html which happen most of the time.

  • loloskiloloski Posts: 46Questions: 5Answers: 1

    in short you are returning the JSON data from your server as a literal string without the proper content-type it won't work use JSON view or any your favorite tool to inspect instead of diving on the code and banging your heads against the wall :)

    good luck once you verify the content-type was set appropriately then go back here. by the way look carefully how you crafted the JSON response. copy the structure based on the example in the documentation just to minimize troubleshooting.

    Just my 0.2 cents hope this make sense

This discussion has been closed.