ravid7000 / table-sortable

A jquery plugin to sort and paginate data in table form.
https://table-sortable.now.sh
MIT License
35 stars 14 forks source link

Help with ajax example #28

Closed gruelas16 closed 2 years ago

gruelas16 commented 3 years ago

Hi, first of all, thank you @ravid7000 for your library is lightweight and very easy to use, but it seems i´m having a hard time to implement a AJAX call that will render only the first 10 element, with the pagination of N pages, and after N page is click i´ll show the next data. If you can please show me son example of the thing i wanna, i´ll be awesome, thanks is advance.

ravid7000 commented 2 years ago

@gruelas16 You can always update the data using setData method on table. So call the setData method after ajax api response. See the example below:

var table = $('#table-sortable').tableSortable({
    data: [],
    columns: columns,
    rowsPerPage: 10,
    pagination: true,
});

$.get(/* url */, function(data) {
    // Push data into existing data
    table.setData(data, null, true);

    // or Set new data on table, columns is optional.
    table.setData(data, columns);
})
ravid7000 commented 2 years ago

Not seeing any activity on it. So closing it.