0

I do search for a specific option in bulk operations. For now, when I click somewhere in my row, the checkbox for the bulk operation gets selected, but I want a user to directly click on the checkbox. If he clicks somewhere in the row, it shouldn't select the row for bulk-operations. Any chance to do that without hacking the core?

In short: only a direct click on the checkbox should select the row for bulk operations.

0

This is due to the JQuery in views_bulk_operation.js :

    // Set up the ability to click anywhere on the row to select it.
$('.views-table tbody tr', form).click(function(event) {
  if (event.target.tagName.toLowerCase() != 'input' && event.target.tagName.toLowerCase() != 'a') {
    $('input[id^="edit-views-bulk-operations"]:not(:disabled)', this).each(function() {
      var checked = this.checked;
      // trigger() toggles the checkmark *after* the event is set,
      // whereas manually clicking the checkbox toggles it *beforehand*.
      // that's why we manually set the checkmark first, then trigger the
      // event (so that listeners get notified), then re-set the checkmark
      // which the trigger will have toggled. yuck!
      this.checked = !checked;
      $(this).trigger('click');
      this.checked = !checked;
    });
  }
});
  • Commenting them will solve it but instead of hacking the core. In your custom js file add something like:
$('.views-table tbody tr').off();
  • This will disable all event handlers!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.