Hi, Try with Ajax loading of the new pages.
I am not sure how DataTables removes and re-adds the rows later. It should use jQuery's clone(true, true) to preserve the event bindings. Ask in their forums. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Sun, Oct 26, 2014 at 12:46 AM, Jason Novotny <[email protected]> wrote: > > I've managed to figure out the cause of the problem but no solution. > > jquery datatables removes DOM elements when configured for pagination. > This means the AjaxLinks in my listview generate wicket javascript like: > > Wicket.Ajax.ajax({"u":"./executed?7-1.IBehaviorListener.0-container- > executedTransactionPanel-executedListView-0-detailsLink","e":"click","c":" > detailsLinkff"});; > Wicket.Ajax.ajax({"u":"./executed?7-1.IBehaviorListener.0-container- > executedTransactionPanel-executedListView-1-detailsLink","e":"click","c":" > detailsLink100"});; > Wicket.Ajax.ajax({"u":"./executed?7-1.IBehaviorListener.0-container- > executedTransactionPanel-executedListView-2-detailsLink","e":"click","c":" > detailsLink101"});; > Wicket.Ajax.ajax({"u":"./executed?7-1.IBehaviorListener.0-container- > executedTransactionPanel-executedListView-3-detailsLink","e":"click","c":" > detailsLink102"});; > ... > > > If the table has 2 pages, it removes the DOM elements from the 2nd page so > I get the wicket debug error "Wicket.Ajax: Cannot bind a listener for > event "click" on element "elementId" because the element is not in the DOM" > > Now when I hit the link for next page of the table, the DOM has been > updated to reflect the rows, but the javascript events need to be added > again and so the links are broken. > > Is there any good way to do this? > > Thanks, Jason > > > On 10/24/14, 1:24 PM, Jason Novotny wrote: > >> >> I should add I'm using Wicket 6.17. >> >> Thanks, Jason >> >> On 10/24/14, 10:47 AM, Jason Novotny wrote: >> >>> Hi, >>> >>> I'm using latest jquery DataTable with a ListView and in wicket:head of >>> the page, I initiate the DataTable: >>> >>> $(function () { >>> $('.datatable_executed').dataTable({ >>> 'lengthChange': false, >>> 'dom': '<"top"<"doc-filter"><"holder"ip>>t', >>> "language": {"info": "_START_-_END_ of _TOTAL_"}, >>> "aaSorting": [], >>> 'iDisplayLength': 12 >>> }); >>> }); >>> >>> It all looks good, however because one of my columns contains AjaxLinks, >>> I get an error from my wicket debug window with the following: >>> "Wicket.Ajax: Cannot bind a listener for event "click" on element >>> "elementId" because the element is not in the DOM" >>> >>> The thing is the links seem to actually work on the first page, but when >>> I click -> to go to the next page the links don't work. Has anyone >>> experienced this before or have any idea how I can debug this? >>> >>> Thanks, Jason >>> >>> >> >
