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

It is possible to populate dropdown using same object key used in groups? #70

Closed
sdillinger opened this Issue Aug 27, 2015 · 7 comments

Comments

Projects
None yet
2 participants
@sdillinger

sdillinger commented Aug 27, 2015

If I provide a string (key) to the groups option - for example, 'division' in the hockey example, the query result sorts and groups by the values it finds.

I want to also filter by those same values using the dropdown. But I can't find a way to associate the two. In the example the dropdown values are 'hard coded' via an array.

Is it possible to associate groups and dropdown so that the dropdown values are the same values from groups?

If not I'd like to suggest it as a new feature as it would be uber-useful for situations where the group values are not known in advance, but are found via a key lookup (as works in groups).

Perhaps it would be a straight-forward hack as you already have the values in context if the user provided a key to the groups option.

@running-coder

This comment has been minimized.

Owner

running-coder commented Aug 28, 2015

Hey sdillinger,

sounds like a great plan, perhaps it should have been like this from the get-go

@running-coder running-coder added this to the 2.4.0 milestone Feb 11, 2016

@running-coder running-coder modified the milestones: 2.4.0, 2.5.0 Mar 26, 2016

running-coder pushed a commit that referenced this issue Mar 31, 2016

@running-coder

This comment has been minimized.

Owner

running-coder commented Apr 1, 2016

I've started working on it thinking it was a great idea to realize 2 hours after that in the case of dynamic data it would not work because only a subset of items is received at a time (10 items only for example) and would not offer all the available groups. This option to "self discover groups" only works if the data is all gathered at once... Might consider allowing the system to have both possibilities but not sure if it would lead to confusion...

// Regular dropdownFilter, fits for dynamic & static data
dropdownFilter: [
    {
        key: 'conference',
        value: 'Western',
        display: '<strong>Western</strong> Conference'
    },
    {
        key: 'conference',
        value: 'Eastern',
        display: '<strong>Eastern</strong> Conference'
    },
    {
        value: '*',
        display: 'All Teams'
    }
],

// Static data only, self discovering groups
dropdownFilter: {
    key: 'division',
    template: '<strong>{{division}}</strong> division',
    all: 'All Teams'
},
@sdillinger

This comment has been minimized.

sdillinger commented Apr 1, 2016

It's been awhile since I've had my head around this...

In my particular use case the data was static, but I see the issue re: dynamic data.

IMO it's pretty powerful and useful functionality, so it may be worth the uptick in complexity...

@running-coder

This comment has been minimized.

Owner

running-coder commented Apr 1, 2016

Yea mb it's been a while, I've finally got some free time to clean the backlog. Alright will implement both ways. Will probably update the group option parameters also to accept the same object structure instead of an array where index 0 is assumed group and index 1 assumed template.

// Old way (not intuitive)
group: ['division', '<strong>{{group}}</strong> division'],

// New way
group: {
    key: 'division',
    template: '<strong>{{division}}</strong> division'
},

running-coder added a commit that referenced this issue Apr 4, 2016

#70 - Populate `dropdownFilter` based on an item.key (self discoverin…
…g groups) for static data

Notes:
- Removed caret option, it is now CSS only
- SVG data uri images
@running-coder

This comment has been minimized.

Owner

running-coder commented Apr 5, 2016

should be good with the upcoming 2.5.0 version, documentation will be updated upon release

running-coder added a commit that referenced this issue Apr 5, 2016

Version 2.5.0
*Breaking Changes*
- Typeahead HTML template
- Group option
- DropdownFilter option

Features:
- #175 Provide a default `loading` state and animation
- #174 Add standard cancel button` option instead of browser's implementation
- #173 Variables for Typeahead SCSS file, it is now more easy to generate your own theme!
- #172 Typeahead using BEM standards
- #70 Populate `dropdownFilter` based on an item.key (self discovering groups) for static data

Fixes:
- #163 "&amp;" instead of "&" in displayed result

Notes:
- Removed caret option, it is now CSS only
- SVG data uri images
@sdillinger

This comment has been minimized.

sdillinger commented Apr 5, 2016

Great. Thanks for all you do.

On Mon, Apr 4, 2016 at 8:29 PM, Tom Bertrand notifications@github.com
wrote:

should be good with the upcoming 2.5.0 version, documentation will be
updated upon release


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#70 (comment)

Steve Dillinger
Founder & CEO

steve@ciqlabs.com
(312) 804-4799

www.getclassroomiq.com

https://www.youtube.com/watch?v=lfTvwbFXVlg

@running-coder

This comment has been minimized.

Owner

running-coder commented Apr 5, 2016

yw, this task was quite challenging at different levels. thanks for suggesting!

running-coder pushed a commit that referenced this issue Apr 6, 2016

tom bertrand
* Version 2.5.0
*Breaking Changes*

Update the following Typeahead configurations
- Typeahead HTML template
- Group option
- DropdownFilter option

Features:
- #175 Provide a default `loading` state and animation
- #174 Add standard cancel button` option instead of browser's implementation
- #173 Variables for Typeahead SCSS file, it is now more easy to generate your own theme!
- #172 Typeahead using BEM standards
- #70 Populate `dropdownFilter` based on an item.key (self discovering groups) for static data

Fixes:
- #163 "&amp;" instead of "&" in displayed result

Notes:
- Removed caret option, it is now CSS only
- SVG data uri images
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment