0.6.0 • Published 6 years ago

ember-cli-selectize v0.6.0

Weekly downloads
857
License
MIT
Repository
github
Last release
6 years ago

Ember-cli-selectize Build Status Ember Observer Score

NOTE: consider using ember-power-select

An Ember and Selectize integration, packaged as an Ember-cli addon. Check Selectize and Ember-cli!

Demo

Check (old demo): http://miguelcobain.github.io/ember-selectize

Installation

ember install ember-cli-selectize

Usage

This addon provides an ember-selectize component. Its usage should be very similar to Ember.Select, but with additional features.

{{ember-selectize
  content=controller.items
  optionValuePath="content.id"
  optionLabelPath="content.name"
  selection=model.item
  placeholder="Select an item" }}

Properties

ember-selectize also supports selectize's general options, excluding options and items (equivalent to content and selection respectively).

Actions

Ember is moving towards a paradigm that encourages the use of actions. With this in mind, ember selectize provides a set of actions. The goal is to not use two way data bindings, that is, you pass the data to your components, but the components send actions up to let you (and only you) change the data. Here are the actions the ember selectize supports:

Ember selectize supports both APIs.

More info:

  • ember-selectize registers observers on object labels. This is great because if you change the label property anywhere in your application, selectize labels will also update.

We will folow Ember Select's approach, which is really flexible:

Option Groups

Ember-selectize supports two flavors of option grouping.

#1 optionGroupPath

Set optionGroupPath to a path for a property to group for. Example:

[
  {
    id: 1,
    category: 'Nature',
    title: 'This title will appear on select'
  },
  {
    id: 2,
    category: 'Nature',
    title: 'This title will appear on select'
  },
  {
    id: 3,
    category: 'Another category',
    title: 'This title will appear on select'
  },
  //...
]

optionGroupPath would be "content.category", which would group items according to that property automatically.

like

{{ember-selectize optionGroupPath="content.category"}}

#2 groupedContent

If you prefer you can group your items yourself and pass them to ember selectize. Just set the property groupedContent to an array with the following format:

[
  {
    label: 'Nature',
    content: [
      {
        id: 1,
        title: 'This title will appear on select'
      },
      {
        id: 2,
        title: 'This title will appear on select'
      }
    ]
  },
  {
    label: 'Another category',
    content: [
      //...
    ]
  },
//...
]

and in your template

{{ember-selectize groupedContent=someArray}}

Theme customization

You can customize which theme to use in your Brocfile.

//your-app/Brocfile.js

var EmberApp = require('ember-cli/lib/broccoli/ember-app');

var app = new EmberApp({
  'ember-cli-selectize': {
    //valid values are `default`, `bootstrap2`, `bootstrap3` or false
    'theme': 'bootstrap3'
  }
});

module.exports = app.toTree();

If you want to use the default theme, you don't need to specify any option. If you don't want to include any css at all for some reason, simply assign false or any "falsy" value to the theme option.

Running

Running Tests

  • npm test (Runs ember try:testall to test your addon against multiple Ember versions)
  • ember test
  • ember test --server

Building

  • ember build

For more information on using ember-cli, visit https://ember-cli.com/.

0.6.0

6 years ago

0.5.12

7 years ago

0.5.11

7 years ago

0.5.10

8 years ago

0.5.9

8 years ago

0.5.8

8 years ago

0.5.7

8 years ago

0.5.6

8 years ago

0.5.5

8 years ago

0.5.4

8 years ago

0.5.3

8 years ago

0.5.2

8 years ago

0.5.1

8 years ago

0.5.0

8 years ago

0.4.4

8 years ago

0.4.3

9 years ago

0.4.2

9 years ago

0.4.1

9 years ago

0.4.0

9 years ago

0.3.9

9 years ago

0.3.8

9 years ago

0.3.7

9 years ago

0.3.6

9 years ago

0.3.5

9 years ago

0.3.4

9 years ago

0.3.3

9 years ago

0.3.2

9 years ago

0.3.1

9 years ago

0.3.0

9 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago

0.0.19

9 years ago

0.0.18

9 years ago

0.0.17

9 years ago

0.0.16

9 years ago

0.0.15

9 years ago

0.0.14

9 years ago

0.0.13

9 years ago

0.0.12

9 years ago

0.0.11

9 years ago

0.0.10

9 years ago

0.0.9

9 years ago

0.0.8

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago