Is there any way to disable datatables from removing none current pages from the DOM?

Is there any way to disable datatables from removing none current pages from the DOM?

rmichelsrmichels Posts: 3Questions: 3Answers: 0

I have this Spring MVC jsp form that gets built into a datatable.

document.getElementById('invoiceManagementForm').submit(function(){
$(oTable.rows().nodes()).find("input:checked").appendTo('#invoiceManagementForm')
})

I tried this, but it doesn't work. The only thing that seems to work involves literally removing the checked nodes from the datatables and attaching them to the bottom of the form:

$(oTable.rows().nodes()).find("input:checked").appendTo('#invoiceManagementForm')
document.getElementById('invoiceManagementForm').submit()

But since my form submit takes the user to a new page, the last page remains with all the checked nodes stuck to the bottom of the page with them now missing from the left hand column of the table, I just really dont know how to get my form to submit with the checked node data.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin
    Answer ✓

    Unfortunately the removal of DOM elements that DataTables doesn't need for a draw is quite deeply baked into the code - it does that for performance and compatibility.

    You could set the page length to be -1 (page.len()) but otherwise you need to append elements to the form as you have done, or better yet use Ajax.

    Allan

This discussion has been closed.