Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem when change "Status" filter #4

Open
JL2014 opened this issue May 23, 2018 · 7 comments
Open

Problem when change "Status" filter #4

JL2014 opened this issue May 23, 2018 · 7 comments

Comments

@JL2014
Copy link

JL2014 commented May 23, 2018

Hi,

When change the status filter, normally, there should be a field that appears when you change the value but it does not appear anymore.

2018-05-23 10_30_15-demandes - clients et assistances - synchronic

2018-05-23 10_30_39-demandes - clients et assistances - synchronic

Greetings.

@sf-cola
Copy link
Owner

sf-cola commented May 27, 2018

Thank you for the report.
I'd like to respond by checking the problem you received.
@JL2014

@vanessasoutoc
Copy link

I also have this problem

@gabriel-cardoso
Copy link

Replacing

var elements = document.getElementsByTagName("select");

by

var elements = $("select:visible");

in slecttoselect2main.js does the job. But it only works if jQuery exists.

@sf-cola
Copy link
Owner

sf-cola commented Feb 8, 2019

@gabriel-cardoso
Thank you for your reporting!!

@tainewoo
Copy link

tainewoo commented Oct 23, 2019

thanks @gabriel-cardoso

tested it's ok with first change to the operator, the value box can be shown
but after change back the operator as open, and then change the operator to be "is", the value box can't be shown again and never shown anymore.

@upbeat-backbone-bose
Copy link

I also have this problem

@mohsen-zanjani
Copy link

mohsen-zanjani commented Aug 7, 2023

Hello
I solved the problem by changing the selector in the following function in the public/javascripts/application.js file from $('#tr_'+fieldId+' td.values .value') to $('#tr_'+fieldId+' td.values .value:not(.select2-container)')

// public/javascripts/application.js
function enableValues(field, indexes) {
  var fieldId = field.replace('.', '_');
  $('#tr_'+fieldId+' td.values select.value:not(.select2-container)').each(function(index) {
    if ($.inArray(index, indexes) >= 0) {
      $(this).removeAttr('disabled');
      $(this).parents('span').first().show();
    } else {
      $(this).val('');
      $(this).attr('disabled', true);
      $(this).parents('span').first().hide(); // this set parent span display of select2 element to 'none'
    }

    if ($(this).hasClass('group')) {
      $(this).addClass('open');
    } else {
      $(this).show();
    }
  });
}

In order to understand the reason for this issue, you need to see the toggleOperator(field) function in this file and the syncCssClasses(dest, src, adapter) function in the plugins/select_to_select2/assets/javascripts/select2-3.4.5/select2.js file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants