Cannot access editor from the table when scroller is initialized

Cannot access editor from the table when scroller is initialized

backupreportbackupreport Posts: 1Questions: 1Answers: 0

I've been using the datatables editor with pagination without any issues. I now want to use the scroller instead of the pagination, but this has cause several problems.

The most predominant being that I can no longer access the editor when I select a row and click edit.

I've made a stand alone example of this issue. I've posted the code to github:
https://github.com/diegoapardo/datatables

And a live example can be accessed here:
datatables-example.herokuapp.com/test.html

I'm not sure what the problem might be, but I am using require.js, which might be causing issues on how the library is being loaded.

Further, in my code, I can't access the editor from the table when the scroller is initialized.
I can get the table by assigning var table = $('.AdminTable').DataTable();, but the editor function returns undefined when I try to assign var editor = table.editor();.

Any insight or suggestions would be appreciated.

Answers

  • allanallan Posts: 63,368Questions: 1Answers: 10,449 Site admin

    Rather than using .AdminTable as the selector for the table, could you use #AdminTable (both when you initialise the Editor and when you attempt to get the Editor instance).

    The problem is that when you enabling scrolling it splits the table into header, body and footer so the class selector can actually end up selecting multiple tables.

    Allan

This discussion has been closed.