Why is _fnRowDeselectAll called when paging?

Why is _fnRowDeselectAll called when paging?

praeterpraeter Posts: 3Questions: 0Answers: 0
edited March 2013 in DataTables 1.8
We have a table using DataTables and TableTools, getting each page of data from the server. If we select items on one page, then goto another page, the items selected on the first page are no longer selected. I'm trying to implement this in a fairly straightforward way - update an array with info about the selections/deselections using fnRowSelected and fnRowDeselected.

It works fine, with one crucial exception - every time I goto another page, _fnRowDeselectAll is called, which loops through the built-in collection of selected objects (this.s.select.selected), calling _fnRowDeselect on each one, effectively undoing my selections.

Is this the default behavior? Why? Is it possible to override? If I could just tell DataTables/TableTools to not do this on each page change, I'd nearly be done with my task.

Replies

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    _fnRowDeselectAll doesn't exist in the latest TableTools. Can you update to 2.1.5 please, and if the problem persists, link to a test page showing the problem.

    Thanks,
    Allan
  • praeterpraeter Posts: 3Questions: 0Answers: 0
    I would update, but, at the moment, I am somewhat locked into the version I am using. I appreciate the reply very much.
  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    Fair enough. I'm afraid that old versions are generally not supported though - since the issues in them should be fixed in the latest versions.

    I'm not sure why _fnRowDeselect would have been getting called in that way - it sounds like an error. It was this commit that removed that internal function - https://github.com/DataTables/TableTools/commit/2a166491c29c4e42b2304990b519ca2c75584069, which was part of a considerable overhaul of the row selection since it was rather lacking.

    TableTools' row selection is being used on this page, and you'll be able to see that row selection is retained in the current release: http://editor.datatables.net/release/DataTables/extras/Editor/examples/index.html . So hopefully this is fixed in the latest version, but if not, we'd need a test case.

    Allan
  • praeterpraeter Posts: 3Questions: 0Answers: 0
    Right on. I trust it is fixed in the latest version (as seen in the example you posted). I'm in the unfortunate position of having to alter the behavior of a rather elaborate customization of DataTables+TableTools, written by someone else. Unfortunately, it incorporates old versions of both libraries, so dropping in updated TableTools and DataTables will break it. Doesn't help that, while I'm competent in js and jquery, I'm no expert. I just have to find a way around it. Thanx again for your time.
This discussion has been closed.