Append records by sAjaxSource instead of replace

Append records by sAjaxSource instead of replace

ArpanTannaArpanTanna Posts: 1Questions: 1Answers: 0
edited November 2016 in Free community support

Hi,

I wanna append records fetch from "sAjaxSource" instead of replace records.

I have thousands of records in database, so I wanna fetch 1000 records per call.
I have added "load more" button, and I want when click on this button new records will fetch and then append in datatable.
(currently _oTable.draw(); removed previous records & display new records on every call)

Can please someone help me??
Here is my datatable code

var recfrom = 0;
var leadEnd = 0;
var _oTable = $('#table-subscriber').DataTable({
            'Processing': true,
            "bProcessing": true,
            'bServerSide': true, 
            "lengthMenu": [[-1], ["All"]],
            "pageLength": -1,
            'sPaginationType': 'full_numbers',
            'sAjaxSource': $.app.urls('base_url')+'client/subscribers/loadLeads',
            'aoColumns': column,
            "fnServerParams": function ( aoData ) {
                aoData.push({'name': 'from', 'value': recfrom});
            },
            "dom": "<'clearfix'T><'row'<'col-sm-5'i>><'row'<'col-sm-12'<'table-responsive'tr>>>",
            'fnRowCallback': function( nRow, aData, iDisplayIndex ) {
                var id = 'row-'+aData[0];
                $(nRow).attr('id',id);
                return nRow;
            },
            fnDrawCallback: function(data)
            {
                var response = data.json;
                if(response.status == 1) {
                    recfrom = response.recfrom;
                    leadEnd = response.leadEnd;
                    if(leadEnd == 1) {
                        $('.load-more').addClass('hide');
                    }
                    else {
                        $('.load-more').removeClass('hide');
                    }
                }
            }
        });

$(document).on('click', '.load-more', function()
    {
        _oTable.draw();
    });
This discussion has been closed.