Search filter is broken

Created on 23 November 2018, almost 6 years ago
Updated 11 November 2023, about 1 year ago

Hi there,

I have found that the latest version breaks the filtering functionality.

The problem is that not all elements are updated with the correct classes. For example, on page load only the first 7 list items have the class ui-sortable-handle

This means that the when searching the items, only the first 7 are considered for filtering. I believe that this is the case because the Drupal.entityreference_dragdrop.filter function is defined before the class of ui-sortable-handle is added to the rest of the list items.

I have found that if I revert these lines:

// ...
      $avail.once('entityreference-dragdrop').each(function () {
        var key = $(this).data('key');
        var $sortableAvail = $(this).sortable({
          connectWith: 'ul.entityreference-dragdrop[data-key=' + key + ']',
          items: '.sorting-initialize'
        });
        $sortableAvail.find('li[data-key=' + key + ']').one('mouseenter', function(){
          $(this).addClass('sorting-initialize');
          $sortableAvail.sortable('refresh');
        });
      });
// ...

to simply:

// ...
      $avail.once('entityreference-dragdrop').each(function () {
        var key = $(this).data('key');
        $(this).sortable({
          connectWith: 'ul.entityreference-dragdrop[data-key=' + key + ']'
        });
      });
// ...

The search then works as expected

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇬🇧United Kingdom sawtell

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024