Problem/Motivation
We recently upgraded from 4.1.2 to 4.1.4 and i see that a feature we were going to add on our own has been added to VBO now. This is to only enable action buttons if items are selected. Unfortunately this upgrade and that feature has now broken our vbo table.
It seems as though this only works if there is only 1 vbo table on the page. We have 2 vbo (in tabs) but single action button on only one of these works correctly by enabling/disabling based on the rows being checked or not. The other is disabled by default and now can not be enabled.
If a row is selected, when the page is refreshed, the state of the action button is set correctly. Oddly, even if the other table has no results (and therefore no checkboxes or buttons showing), the other table is still broken.
i do see that the toggleButtonsState js code is not working correctly in that anyItemsSelected is still 0 when selecting items on the broken table.
I'll see if i can debug further and possibly come up with a patch. My guess is selector for this needs to include table ID.
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork views_bulk_operations-3300794
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
liquidcms commentedAh, my bad:
this is not true, the code is only being run on the 1 table. likely needs a .each() here somewhere.
Comment #3
liquidcms commentedi think the bind function is binding the last form that is hit to all the checkboxes rather than just the ones for that form. jquery is definitely not my strong point; but rather than using this.vbo_form everywhere, i changed the code to this:
and this fixes the issue. I'd create a patch; but guessing a cleaner way to do this??
Comment #4
liquidcms commentedhmm, better, but not perfect. Default setting on page refresh is not always correct.
Comment #5
liquidcms commentedthe following code seems to work pretty reliably but i suspect there is a cleaner selector that could be used so haven't created a patch. Could do though if of any help to anyone.
Comment #6
graber commentedComment #7
duneblThe patch in #5 is solving my problem.
Many Thanks!
Comment #9
graber commented@DuneBL, that's great but please try the diff from the MR (https://git.drupalcode.org/project/views_bulk_operations/-/merge_requests/39.diff), it's a cleaner solution as it creates a new independent selection object for every form.
@liquidcms thank you for working on this as well!
Comment #10
duneblHello,
I confirm that MR39 is solving this issue.
Many thanks!!
Comment #11
graber commentedThanks!