eakoriakin / ionic-selectable

Ionic Selectable is an Ionic versatile and highly customizable component that serves as a replacement to Ionic Select, and allows to search items, including async search, create items, customize the layout with templates and much more. It provides an intuitive API and is easy to set up and use.
MIT License
550 stars 126 forks source link

Enum support #312

Closed AmeerIT closed 4 years ago

AmeerIT commented 4 years ago

i tried using Object.keys to enumerate some enum keys, but it only displayed No items found. does the plugin support enum? or have plans to support enums?

AmeerIT commented 4 years ago

Hello i have solved the solution by mapping the Enum to Array

mapEnumToArray() { this.venutTypes = []; for (var n in BusinessCategory) { this.venutTypes.push({ name: BusinessCategory[n], value: n }) } }

and set the text and value fields inside the ionic-selectable itself to display the name and value in that order

itemTextField="name" itemValueField="value"