filtering multi select dropdown options

Madasu K

In my angularjs application,I am using multi select drop down https://tamtakoe.github.io/oi.select/#/select/#filtered, with the following:

<oi-multiselect  ng-options="item.name for item in ins_Types " ng-model="insuranceTypes"  multiple placeholder="Select" data-ng-required="true" name="insType" ></oi-multiselect >

and

 $scope.ins_Types = [{id: 1, name : "ins1"},{id: 2, name : "ins2"}, {id: 3, name : "ins3"}, {id: 4, name : "ins4"}];

which is working fine for all the options in $scope.ins_Types. Now I want the option with id < 3 only to be displayed. So I have used the filter to options as shown below :

<oi-multiselect  ng-options="item.name for item in ins_Types | filter:{id < 3} " ng-model="insuranceTypes"  multiple placeholder="Select" data-ng-required="true" name="insType" ></oi-multiselect >

But since then the multi select dropdown stopped responding and none of the options are getting displayed.

I even tried | filter:{item.id < 5} but still the same problem.

M. Junaid Salaat

You can create a custom filter for your requirement like

app.filter('myfilter', function() {
  return function(input, condition) {
    var filtered = [];
    input.forEach(function(item, index) {
      if (item.id > condition) {
        filtered.push(item);
      }
    });
    return filtered;
  };
});

And in your markup use it like

<oi-select oi-options="item.name for item in ins_Types | myfilter : 3 track by item.id" ng-model="insuranceTypes" multiple placeholder="Select"></oi-select>

Live Plunker

Hope it helps.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

how to disable dropdown options based on the previously selected dropdown values in multi select dropdown?

From Dev

How do I select all options in a jQuery Chosen multi-select AFTER search filtering?

From Dev

Hide options in dropdown select

From Dev

yadcf - multi_select with select2 - options dropdown not case sensitive

From Dev

Multi select dropdown list

From Dev

Multi select dropdown select all

From Dev

How to delete options in Select dropdown

From Dev

Updating second multi select dropdown based on first multi select dropdown

From Dev

Multi select values options jenkins

From Dev

PHP set multi select dropdown

From Dev

PHP: Filtering SQL query with select options

From Dev

Consecutive dropdown filtering missing default select value

From Dev

Filtering data based on dropdown select Laravel 5.6

From Dev

Filtering array on multiple options to return options in new select

From Dev

selenium iterate through options in dropdown select

From Dev

Selenium Select Multiple options from dropdown

From Dev

How to select multiple options in dropdown in Apache Wicket?

From Dev

Cant Append options to a select dropdown dynamically

From Dev

Create array with values of multiple select dropdown options

From Dev

Allowing users to select options from a dropdown

From Dev

How to change outline color of the dropdown options in a select?

From Dev

Retrieve all selected options from a multi select

From Dev

Asynchronous updating list of options for multi select MVC

From Dev

Retrieve all selected options from a multi select

From Dev

Show model values as multi select options in admin

From Dev

Multi select dropdown with checkbox & search method

From Dev

AngularJS set values of multi-select dropdown

From Dev

Multi select dropdown using jquery JTable library

From Dev

Detect if a dropdown list is a multi-select

Related Related

  1. 1

    how to disable dropdown options based on the previously selected dropdown values in multi select dropdown?

  2. 2

    How do I select all options in a jQuery Chosen multi-select AFTER search filtering?

  3. 3

    Hide options in dropdown select

  4. 4

    yadcf - multi_select with select2 - options dropdown not case sensitive

  5. 5

    Multi select dropdown list

  6. 6

    Multi select dropdown select all

  7. 7

    How to delete options in Select dropdown

  8. 8

    Updating second multi select dropdown based on first multi select dropdown

  9. 9

    Multi select values options jenkins

  10. 10

    PHP set multi select dropdown

  11. 11

    PHP: Filtering SQL query with select options

  12. 12

    Consecutive dropdown filtering missing default select value

  13. 13

    Filtering data based on dropdown select Laravel 5.6

  14. 14

    Filtering array on multiple options to return options in new select

  15. 15

    selenium iterate through options in dropdown select

  16. 16

    Selenium Select Multiple options from dropdown

  17. 17

    How to select multiple options in dropdown in Apache Wicket?

  18. 18

    Cant Append options to a select dropdown dynamically

  19. 19

    Create array with values of multiple select dropdown options

  20. 20

    Allowing users to select options from a dropdown

  21. 21

    How to change outline color of the dropdown options in a select?

  22. 22

    Retrieve all selected options from a multi select

  23. 23

    Asynchronous updating list of options for multi select MVC

  24. 24

    Retrieve all selected options from a multi select

  25. 25

    Show model values as multi select options in admin

  26. 26

    Multi select dropdown with checkbox & search method

  27. 27

    AngularJS set values of multi-select dropdown

  28. 28

    Multi select dropdown using jquery JTable library

  29. 29

    Detect if a dropdown list is a multi-select

HotTag

Archive