README.md in activeadmin_selectize-0.1.3 vs README.md in activeadmin_selectize-0.1.4

- old
+ new

@@ -23,10 +23,22 @@ ``` - Use the input with `as: :selectize` in Active Admin model conf Why 2 separated scripts? In this way you can include a different version of Selectize.js if you like. +## Notes + +- In ActiveAdmin json routes should be enabled by default, this behavior is controlled by *download_links* option for index action. Example: + +```rb +index download_links: [:csv, :json] do + # ... +end +``` + +- If the select items "gets cut" by the container try adding: `'data-opts': '{"dropdownParent":"body"}'` + ## Example Example 1: an Article model with a many-to-many relation with Tag model: ```ruby @@ -45,9 +57,18 @@ f.input :published f.input :tags, as: :selectize, collection: f.object.tags, input_html: { 'data-opt-remote': admin_tags_path( format: :json ), 'data-opt-text': 'name', 'data-opt-value': 'id', 'data-opt-highlight': 'true', placeholder: 'Search a tag...' } end f.actions end +``` + +Example 2: using selectize in filters: + +```ruby +# Without remote items (no AJAX): +filter :name_eq, as: :selectize, collection: Author.all.pluck( :name, :name ) +# With remote items: +filter :tags_id_eq, as: :selectize, collection: [], input_html: { 'data-opt-remote': '/admin/tags.json', 'data-opt-text': 'name', 'data-opt-value': 'id', 'data-opts': '{"dropdownParent":"body"}', placeholder: 'Search a tag...' } ``` ## Options Pass the required options using `input_html`.