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

inuse class not applied to multi-select chosen inputs #389

Closed
galvarez421 opened this issue Mar 3, 2017 · 6 comments
Closed

inuse class not applied to multi-select chosen inputs #389

galvarez421 opened this issue Mar 3, 2017 · 6 comments

Comments

@galvarez421
Copy link

It seems that the inuse class is not being applied to multi-select chosen inputs. The issue can be seen here: http://yadcf-showcase.appspot.com/DOM_source_chosen.html.

The inuse class is being applied to all other column filter inputs on that page. This can be tested by opening the browser console and running the command

$(".inuse").length

after providing a value for each input. This number will increase after providing a value for each input except for the multi-select. You can also inspect the element and see that no inuse class is being applied to it when it has one or more selections.

@vedmack
Copy link
Owner

vedmack commented Mar 3, 2017

its by design, I thought if user wants to use third party plugin on top of the filter he wont be needing the inuse class and its "filter coloring" , until now no one asked for it too :) , I can agree that it might look no consistent that some filters being colored and some not. why do you want that class to be added to chosen multi select?

@galvarez421
Copy link
Author

Hi, thanks for the prompt reply!

I would like to use the class as a CSS hook, namely, I am trying to add a background color to active chosen inputs like this:

.inuse + .chosen-container-single .chosen-single,
.inuse + .chosen-container-multi .chosen-choices {
background-color: #d9edf7;
}

This works for the single chosen but not for the multi chosen input due to the missing class for the latter.

I am sure I can add some custom JS (or possibly just CSS) instead of relying on the .inuse class, but I just figured that this behavior was a bug because the application of the classes seems to be inconsistent: notice in the link provided in the OP that the select element before the .chosen-container-single element receives the .inuse class when it is being used but the select element before the .chosen-container-multi element does not... I guess I would just expect the class to be consistently applied for select elements using the Chosen plugin.

@vedmack
Copy link
Owner

vedmack commented May 11, 2017

Please take a look at the jsfiddle sample and let me know if that what you wanted, it uses the latest yadcf beta 0.9.2.beta.9

@galvarez421
Copy link
Author

Yes, that is what I wanted. Thanks!

I updated the jsfiddle to show example CSS using the inuse class as a styling hook for the Chosen inputs.

https://jsfiddle.net/6n7bn2tx/14/

@vedmack
Copy link
Owner

vedmack commented May 11, 2017

Cool, then I will commit it to github repo later on, for meanwhile will post your code here for future reference


$(document).ready(function() {
  var table = $('#example').DataTable({
    responsive: true
  });
  yadcf.init(table, [{
    column_number: 1,
    filter_type: "select",
    select_type: "chosen"
  }, {
    column_number: 2,
    filter_type: "multi_select",
    select_type: "chosen"
  }, ]);
});

css


.inuse + .chosen-container-single .chosen-single,
.inuse + .chosen-container-multi .chosen-choices {
  background-color: #d9edf7;
  background-image: none;
}

@vedmack
Copy link
Owner

vedmack commented May 11, 2017

added in yadcf 0.9.2.beta.9

@vedmack vedmack closed this as completed May 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants