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

item-value-key vs. item-view-value-key #173

Closed
rodrigobnn opened this issue May 6, 2016 · 4 comments
Closed

item-value-key vs. item-view-value-key #173

rodrigobnn opened this issue May 6, 2016 · 4 comments
Assignees
Labels
Milestone

Comments

@rodrigobnn
Copy link

I made a change so I could show a text in the list and a different in the input after the item had been selected, in ngModelController.$render I changed from itemViewValueKey to itemValueKey, so pretty simple and no hard for other cases.
Would be nice to have an option so I could use different values in a future version.

Thanks for the ion-autocomplete. very nice!

@guylabs
Copy link
Owner

guylabs commented May 10, 2016

Hi @rodrigobnn,

can you maybe elaborate more on your use case and what exactly you want to achieve? A running example in a codepen would be nice or at least some snippets of the object and how you defined the ion-autocomplete directive such that I am able to help you out.

Thanks and regards,

Guy

@guylabs guylabs added this to the 0.3.3 milestone May 10, 2016
@guylabs guylabs self-assigned this May 10, 2016
@rodrigobnn
Copy link
Author

Hi @guylabs
What I wanted to achieve is have 3 different values in 3 parts of my code. My object is like this:
{
"id": 1,
"name": "Java",
"path": "/home/Java"
}

I save the whole object in my "ng-model" directive, when I type something to filter the option label should show "/home/Java" but once I click it I want to see in the original input field as the result of my selection "Java". The library uses "item-view-value-key" to define the label in the list and what to show in the input after select. What I suggested is to use the value in "item-value-key" to define what will be showed in the input after select the option with "/home/Java".

<input ion-autocomplete ... ng-model="object" item-value-key="name" item-view-value-key="path" ... />

@guylabs
Copy link
Owner

guylabs commented May 14, 2016

Hi @rodrigobnn,

ok so you mean that you want to store the value Java but displaying /home/Java in the list when you filter and when you then select the /home/Java item it should show Java again in the input field right?

Well this is not supported currently and I do not see the added value of it. Imagine that the user selects value A and then it converts it to another value when selected. This can confuse the user as the value is not the same as the user selected initially.

I think the problem would be solved on your side when issue #28 is implemented as then you can override the render function and have your custom logic there.

I hope this is ok for you and I try to add this as soon as possible.

Thanks and regards,

Guy

@guylabs
Copy link
Owner

guylabs commented Jun 21, 2016

Hi @rodrigobnn,

I will close the issue due to inactivity. Please reopen it if there is still an issue.

Thanks and regards,

Guy

@guylabs guylabs closed this as completed Jun 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants