Select extension and server-side processing mode

Select extension and server-side processing mode

gyrocodegyrocode Posts: 126Questions: 6Answers: 30
edited March 2016 in Free community support

It appears that Select extension doesn't retain selected rows when server-side processing mode is used, see this example.

Row selection can be implemented in server-side processing mode without Select extension as shown in this example. However this page is somewhat misleading because Select extension doesn't retain selection in server-side processing mode:

If you are looking for a more complete and easier to use row selection option, check out the Select extension provides an API that is fully integrated with DataTables for selecting rows and acting upon those selected rows.

Is there any way to make Select extension retain selection in server-side processing mode?

Answers

  • allanallan Posts: 61,665Questions: 1Answers: 10,096 Site admin

    I'm sorry to say that there isn't. The problem with server-side processing is that the client-side doesn't know anything about the rows that aren't being displayed. It might be possible to have Select retain the ids of the rows that were selected (which is what this example does), but what do you do if the end user then clicks "Edit"? The row no longer exists, so there is no data about it on the client-side.

    Another example is, what if the user clicks "Select all" - does that select only the rows available at the client-side? If it includes the other rows as well, then how does it keep track of those rows that it knows nothing about?

    Its for these reasons that Select doesn't attempt to retain row selection with server-side processing enabled.

    Allan

  • gyrocodegyrocode Posts: 126Questions: 6Answers: 30

    Thanks for the answer.

    Regarding your use cases, user will always click "Edit" for the row presently on screen, therefore there would be data for it.

    Behavior of selectAll could be modified to detect server-side mode and select current page only, it's better than to have no support for server-side mode at all.

    It seems that there is some code in the extension to retain row IDs using rowId option according to Retain selection on reload example.

    However while looking at the source code, I noticed that Select extension does it differently than the example you've mentioned therefore it doesn't work in server-side processing mode.

This discussion has been closed.