draw() on invisible rows

draw() on invisible rows

leonardo222leonardo222 Posts: 2Questions: 1Answers: 0
edited December 2018 in Free community support

I am currently working on the integration of DataTables with Pusher and everything so far works great with one exception: at the moment I am updating the rows using:

table.row(rowElement).data(date).draw (false);

however, draw() only refreshes the visible rows. How can I refresh other rows that are invisible at the moment, e.g. are on another page?
Here is my initializer:

var table = $('#example').DataTable( {
    "ordering": false,
    "bLengthChange": false,
    deferRender: false,
    pageLength: 10,
    ajax: '{{ absolute_url(path('posts')) }}',
    columns: [
        {
            data: 'name',
            name: 'name'
        },
        {
            data: 'content',
            name: 'content'
        },
        {
            data: 'isActive',
            name: 'isActive'
        },
        {
            data: 'isReaded',
            name: 'isReaded'
        },
        {
            data: null,
            className: 'change-status',
            defaultContent: '<button>XXXX</button>'
        }
    ],
    createdRow: function (row, data, dataIndex) {
        rowClass($(row), data);
    }
});

Answers

  • allanallan Posts: 63,471Questions: 1Answers: 10,467 Site admin

    Can you link to a page showing the issue please? There should be no reason why that wouldn't work with your rows on other DataTables' pages.

    Allan

  • leonardo222leonardo222 Posts: 2Questions: 1Answers: 0

    Here you are:
    https://dev.leonardo.pl/symfony/symfony_pusher_datatables/public/
    Reproduce:
    * Open this link 2 times - one in main browser, second e.g. in incognito.
    * In first go to 3rd page, on the second stay on 1st page.
    * Click button on any record on this 3rd page, e.g. Nazwa posta_28, it's should change color (green - red)
    * Go to 2nd window (where you are on 1st page), go to 3rd page. You should see same status (color) like on 1st window but it's not changed.

  • kthorngrenkthorngren Posts: 21,303Questions: 26Answers: 4,947

    Went to the link you provided and its asking for a password. If you don't want to provide the login credentials on the forum then you can send them directly to Allan by clicking the Ask a Private Question link on the top right of this page.

    Kevin

This discussion has been closed.