Skip to content
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

[Dropdown] Query remote for dropdowns using custom values key #3080

Closed
bradiosd opened this issue Sep 23, 2015 · 2 comments
Closed

[Dropdown] Query remote for dropdowns using custom values key #3080

bradiosd opened this issue Sep 23, 2015 · 2 comments
Milestone

Comments

@bradiosd
Copy link

I'm working with remote query dropdown lists and I've noticed that the custom field key setting for values is not working... It gets completely ignored in fact. I don't know the Semantic UI codebase well enough to issue a pull request and I might break other things but perhaps someone else can fix it?

Example... Setting the field keys.

$('.ui.dropdown').dropdown('setting', {
    apiSettings: {
        url: '<api_url>',
    },
    fields: {
        values: 'results', // Custom set result key
        name: 'name',
        value: 'id'
    }
});

In the combined semantic-ui.js file on line 4778. The code currently looks like this.

onSuccess : function(response) {
  module.remove.message();
  module.setup.menu({
    values: response.results // This is HARD CODED to results. Should take value from custom defined key
  });
  callback();
}

Let me know if this needs explaining further or if I'm wrong... I've hacked the code to work for me now.

@johnschult
Copy link
Contributor

It looks like this might be fixed on master:

https://github.com/Semantic-Org/Semantic-UI/blob/master/src/definitions/modules/dropdown.js#L3388

However the values variable is never used...

@jlukic
Copy link
Member

jlukic commented Sep 24, 2015

Original poster is correct, this is hard coded and shouldnt be.
https://github.com/Semantic-Org/Semantic-UI/blob/master/src/definitions/modules/dropdown.js#L669

@jlukic jlukic added this to the 2.1.5 milestone Sep 24, 2015
@bradiosd bradiosd changed the title Query remote for dropdowns using custom values key [dropdown] Query remote for dropdowns using custom values key Sep 25, 2015
@bradiosd bradiosd changed the title [dropdown] Query remote for dropdowns using custom values key [Dropdown] Query remote for dropdowns using custom values key Sep 25, 2015
jlukic added a commit that referenced this issue Nov 1, 2015
@jlukic jlukic closed this as completed Nov 1, 2015
jlukic added a commit that referenced this issue Nov 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants