Delete row pagination broken?

Delete row pagination broken?

vogomatixvogomatix Posts: 38Questions: 3Answers: 7

If you look at the datatables delete single row example, and start deleting items on the last page of results, datatables seems to break the pagination. It displays a full page of results instead of just the remaining results on that page.

Any ideas for a fix/workaround?

Replies

  • vogomatixvogomatix Posts: 38Questions: 3Answers: 7
    edited June 2014

    This is the workaround I currently have for the problem (single row deletion). It finds the index of the row before the one to be deleted and calculates which page that row is on....

    rowData = rows.data();
    
    // find index of row to be deleted...
    newIdx = rows.index();
    if (newIdx > 0) { 
        newIdx-- 
    }
    rows.remove().draw(false);
    pos = dTable.rows()[0].indexOf(newIdx);
    page = Math.floor(pos / table.page.info().length);
    table.page(page).draw(false);
    
    
    
This discussion has been closed.