Problem/Motivation

When 'Group and Compress' is activated in a view, the bulk operations checkboxes will stop matching up to the right rows. It seems to be because the bulk operation field adds placeholder text (i.e. <!--form-item-example_field--X-->, where X is the row number) to the field output, which gets replaced much later with the actual checkboxes. When Views Aggregator Plus re-sorts/compresses the result set it isn't updating the associated placeholder text, which causes the problem.

Proposed resolution

Without making larger changes to how bulk operations handles this, the only solution I could come up with is just looking for a BulkForm or ViewsBulkOperationsBulkForm field in the view and regenerating the placeholder text based on the new row indexes. That's what the attached patch does.

Comments

jacobbell84 created an issue. See original summary.

jacobbell84’s picture

Attempting to fix code styling issues

jacobbell84’s picture

Issue summary: View changes
tr’s picture

Status: Needs review » Needs work

"Failed to Apply" because your patch has DOS line endings instead of Unix line endings.

dinesh18’s picture

Assigned: jacobbell84 » Unassigned
Status: Needs work » Needs review
StatusFileSize
new1.18 KB

#2 patch added again with the fixes

tr’s picture

Status: Needs review » Needs work

Tabs aren't allowed, and your patch introduces a syntax error into Table.php

jacobbell84’s picture

Thanks TR, I believe I converted the newline characters over to unix format for this patch.

jacobbell84’s picture

Status: Needs work » Needs review
jordik’s picture

Tested VBO version 8.x-3.2 with the latest dev version of Views Aggregator.
The checkboxes seem to work without the patch.
Is there something I am missing?
And beyond that - what is the use case of having bulk operations on aggregated (overwritten) values?

jordik’s picture

Status: Needs review » Postponed (maintainer needs more info)
jacobbell84’s picture

Status: Postponed (maintainer needs more info) » Active
StatusFileSize
new112.38 KB
new123.95 KB
new120.46 KB

Hi JordiK,
I updated to the latest dev release (and 3.2 of VBO) and can still reproduce it on my side. Let me see if I can explain better, as it's a somewhat complex use-case. My specific use case is the registration listing for an events implementation. Each registration can have a primary registrant (the person actually signing up for the event) and 0 to many guests. On that registration listing screen the client wishes to see all the registrants for a given registration. I currently accomplish that by doing a join on a registrant table. They also need the ability to send out email alerts to them (In case of cancellations and what not), which I'm accomplishing by a custom views bulk operation action. If I don't do any sort of aggregation, the view will look like the screenshot below:

View with no aggregation

Not ideal because only the primary registrant has an email address, so the client would need to filter out all the "guest" records manually, otherwise multiple emails would go out since the bulk action is based on the registration id, not the registrants. I think views aggregation makes sense in this case, because the only fields being overwritten (the registrant information) don't matter, as all I'm concerned with for my custom bulk action is the registration id. If I set the registration id to be the "group and compress" column and set the name/registrant type columns to be "Enumerate *" it will look like the screenshot below:

View with aggregation but no patch

Visually it's exactly what I'm looking for, but you can see the checkboxes stop half way down the page. I believe it's because the ID of the checkbox is based on the row number and not the actual entity id. So even though the column being compressed (The registration ID) are identical between the two rows, the checkbox is actually different between the rows. Because the ID numbers of the checkboxes are now greater then the actual rows in the system, the admin stops rendering the checkbox early. The patch above corrects the IDs so that they match the rows properly again, which produces a result like the screenshot below:

View with aggregation and patch

jordik’s picture

Thank you @jacobbell84 for this explanation.
I could reproduce the issue. The patch provided solves it.
I added some very minor changes to it (use statement and comment) and re-rolled it to the new dev version.

  • JordiK committed 82d36d7 on 8.x-1.x
    Issue #3040814 by jacobbell84, JordiK, Dinesh18, TR: Grouping breaks...
jordik’s picture

Status: Active » Fixed

Committed.

jacobbell84’s picture

Thanks for the quick turn-around!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

jacobbell84’s picture