How to get row data in fnServerData of data table

微笑、不失礼 提交于 2019-12-25 04:21:22

问题


I am using ajax datatable as below

$(document).ready(function() {
    var table =  $('#table').dataTable( {
        "iDisplayLength": 10,
        "processing": true,
        "serverSide": true,
        "bStateSave": true,
        "bDeferRender" : true,
        "sAjaxSource": { "url":"<?php echo base_url()?>",

        "type": "GET",
        "orderClasses" : false
      },
        "fnCreatedRow": function( nRow, aData, iDataIndex ) 
        {

        },
        "fnServerData": function (sSource, aoData, fnCallback) {

            $.getJSON(sSource, aoData, function (json) {

                fnCallback(json);
            });
        },

   } );
});

data loads in table but now on next request I want to send last row details back to server.I can send data in fnServerData But I am not able to access last record inserted in table as it is dynamically rendered. I tried using

$('#table tr:last td:last').html()

in fnServerData its blank. How I can get this data in fnServerData

来源:https://stackoverflow.com/questions/55708529/how-to-get-row-data-in-fnserverdata-of-data-table

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!