When you click on 'Select All' button it actually selects all the items in the list only the first time. I found that the problem is in entity_reference_view_widget.js file:
if ($(this).data('unselect')) {
$(checkboxes).removeAttr('checked');
$(this).data('unselect', 0).text(Drupal.t('Select all'));
}
else {
$(checkboxes).attr('checked', 'checked');
$(this).data('unselect', 1).text(Drupal.t('Unselect all'));
}
I managed to fix it on my project by replacing removeAttr and attr functions with the prop function using false and true respectively.
if ($(this).data('unselect')) {
$(checkboxes).prop('checked',false);
$(this).data('unselect', 0).text(Drupal.t('Select all'));
}
else {
$(checkboxes).prop('checked',true);
$(this).data('unselect', 1).text(Drupal.t('Unselect all'));
}
Comments
Comment #1
lmouzos commentedComment #2
jsacksick commentedUnfortunately, we can't use prop() because it has been added in Jquery 1.6 and Drupal 7 only ships with jQuery v1.4.4.
Comment #3
plopescHello,
I'm having this problem too, but in my case, I'm using JQuery Update module, so my JQuery version is higher than 1.6, where
prop()method was added.Here I'm proposing a patch that checks the JQuery version and in case version in lower than 1.6, fallbacks to use
attr()instead ofprop().Hope this helps!
Thank you again for this great module :)
Comment #4
carolpettirossi commented#3 works for me.
Comment #5
fran seva commentedI have reviewed the code and looks good. The way the version is checked is correct so let's move it to RTBC
Comment #7
jsacksick commentedCommitted, thanks.
Comment #9
jamsilver commentedAs far as I can tell, the fix here broke the 'Select all' link - see #2771281: The "Select all" link does not work