Datatable itotalRecords manupilation

Datatable itotalRecords manupilation

aselkaselk Posts: 1Questions: 1Answers: 0

I fetch some data according to offset and range value. However, I want to show count of records on my databletable with using itotalRecords.

I have 4.700 data on my database, and I just want to show counts of these on my datatable even if I bring just 10 data.

getting value is on controller OK, but I couldn't show

I tried many things, but they didn't work.

What should I do?

Here is

Controller;

DataTableObject dataTableObject = new DataTableObject();

PrintWriter out = response.getWriter();
response.setCharacterEncoding("UTF-8");
response.setContentType("application/json");

    List<HataSorgulama> getButunHatalar = dataService.getHata(0, 15);

     dataTableObject.setAaData(getButunHatalar);
     dataTableObject.setiTotalRecords(dataService.getTotalRecords());

    Gson gson = new GsonBuilder().setPrettyPrinting().serializeNulls().create();
    String json = gson.toJson(dataTableObject);
    out.print(json);
    return null;

Here is jquery;

$(document).ready(function() {

        $('#listTable1').dataTable({
            "bJQueryUI": true,
            "bSort": false,
            "bServerSide": false,

            "sAjaxSource": "hatagetir.htm",
            //"fnServerParams": function ( aoData ) {aoData.push( { "name": "more_data", "value": "my_value" } )},
            "fnServerData": function ( sSource, aoData, fnCallback, oSettings ) {
                $.getJSON( sSource, aoData, function (json) {
                    oSettings._iRecordsTotal = parseInt(json.iTotalRecords, 10);
                    oSettings._iRecordsDisplay = parseInt(json.iTotalRecords, 10);
                    oSettings.aiDisplay.length = parseInt(json.iTotalRecords, 10);
                    fnCallback(json);
                } );
            },
             "sPaginationType": "full_numbers",

            "oLanguage": {
                  "sProcessing":   "Lütfen Bekleyiniz...",
                  "sLengthMenu":   "Sayfada _MENU_ Kayıt Göster",
                  "sZeroRecords":  "Kayıt Bulunmadı",
                  "sInfo":         "  _TOTAL_ Kayıttan _START_ - _END_ Arası Kayıtlar",
                  "sInfoEmpty":    "Kayıt Yok",
                  "sInfoFiltered": "( _MAX_ Kayıt İçerisinden Bulunan)",
                  "sInfoPostFix":  "",
                  "sSearch":       "Bul:",
                  "sUrl":          "",
                  "oPaginate": {
                          "sFirst":    "İlk",
                          "sPrevious": "Önceki",
                          "sNext": "Sonraki",
                          "sLast": "Son"
                      }
                  },
                  "aLengthMenu": [[10, 25, 50, 100, 250, 1000, -1], [10, 25, 50, 100, 250, 1000, "Hepsi"]],
                  "aoColumns": [
                      {"mData": "hataId"},
                      {"mData": "remoteIp"},
                      {"mData": "tarayiciInfo"},
                      {"mData": "hataNedeni"},
                      {"mData": "bsvno"},
                      {"mData": "kisiNo"},
                      {"mData": "goruntuleyen"},
                      {"mData": "durum"},
                      {"mData": "hataTur"},
                      {"mData": "programHrktId"},
                      {"mData": "reqUrl"},
                      {"mData": "tarih"}
                  ]
              });
This discussion has been closed.