deferedRender and Selecting all rows issue

deferedRender and Selecting all rows issue

BScharfBScharf Posts: 9Questions: 2Answers: 0

I have a project where I am using datatables, and sometimes the results from an AJAX call can come back with thousands (even 10s of) records. Plus we also have to support IE, so regular rendering doesn't work without freezing the UI. I have implemented selection/deselection, pagination, sorting, etc, along with deferedRender and its working great, but there is one additional use case that I need to cover.

I need to allow users to select a row, or multiple rows, and that is working fine (even across pages) with one exception. I also have to allow the users to select ALL rows, even if some of the rows haven't been rendered yet, and the regular "table.rows().select()" isn't working because if the rows aren't rendered they don't get selected (but they do select upon rendering). But I then would also need to allow the users to interact with all of the selected rows to maybe deselect some of the rows, which again, doesn't work with the deferedRender. Since my data has come back from an AJAX call as JSON, I store that in a variable and then use that when initializing the table, so I could use the variable (full dataset) if the user selects everything. However, that still doesn't allow the user to interact with all of the "selected" rows, to deselect anything (since they can only deselect what has rendered).

Is there anyway to use both deferedRender and allowing selection of all records, as well as deselection of certain rows without still trying to render everything first?

One option I have thought of doing is maybe putting a warning on clicking "Select All" that it might take some time, and then page through programmatically and select all rows, but again, since this is IE, its taking forever, sometimes upwards of 40 seconds. Any ideas or thoughts?

This question has an accepted answers - jump to answer

Answers

  • BScharfBScharf Posts: 9Questions: 2Answers: 0

    Also, my proposed solution may not be doable because it doesn't allow the user to deselect anything after hitting Select All, but I need to talk to my PM first.

  • colincolin Posts: 15,237Questions: 1Answers: 2,598
    Answer ✓

    Hi @BScharf ,

    I just tried it here - and all the rows are being selected as expected. Could you look at that, please, and see if it helps. If it's still not working for you, please can you update my example, or link to your page, so that we can see the problem.

    Cheers,

    Colin

  • BScharfBScharf Posts: 9Questions: 2Answers: 0

    I ended up using your solution (with some minor tweaks) and was able to get it working properly. I think since some of my other code was using the DOM classes and selectors, once I switched those to the code you shared, it works properly now. Thank you very much for your help.

This discussion has been closed.