stwe / DatatablesBundle

This Bundle integrates the jQuery DataTables plugin into your Symfony application.
355 stars 237 forks source link

Does MultiselectColumn require or use the Select extension? #986

Open craigh opened 2 years ago

craigh commented 2 years ago

Support question

The docs are not clear of any requirement or interaction between the MultiselectColumn and the DataTables Select Extension.

Does one require the other? Can I use Select without Multiselect?

craigh commented 2 years ago

ok, so I see that indeed you can implement a MultiSelectColumn with or without the Select extension. (I currently have it without), now my question is how to make the 'select all' checkbox in the header work?

Screen Shot 2022-06-08 at 8 21 14 AM

Bug

Should this work 'out of the box' or do I need to write my own JS?

I see that The Select extension includes some buttons for select all/none - but I was trying to see if that is now required for this functionality.

I am using datatables.net 1.10.25 and sg/datatablesbundle v1.3.0

I look forward to your response. thank you!

craigh commented 2 years ago

refs https://github.com/stwe/DatatablesBundle/issues/662#issuecomment-334290999

Possible Bugfix

I have found that

https://github.com/stwe/DatatablesBundle/blob/776259357441a2e4752d0f852f6e995f1d6dd90c/Resources/views/datatable/multiselect_actions.html.twig#L140

and

https://github.com/stwe/DatatablesBundle/blob/776259357441a2e4752d0f852f6e995f1d6dd90c/Resources/views/datatable/multiselect_actions.html.twig#L92

need to be changed. In both cases, the selector needs to be changed from

$("#sg-datatables-{{ datatable.name }}")

to

$("#sg-datatables-{{ datatable.name }}_wrapper")

after that change, the select all/none checkbox at the top of the table works as expected and also the action buttons at the bottom enable/disable as expected.