Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Problem populating #599

Open
eago99 opened this issue Jan 21, 2015 · 7 comments
Open

Problem populating #599

eago99 opened this issue Jan 21, 2015 · 7 comments

Comments

@eago99
Copy link

eago99 commented Jan 21, 2015

Hello
I have created this plunk to show the issue I am having.
Not sure if is a bug or if I am missing something.
http://plnkr.co/edit/oXbqsIKKXjBqxCqsKifk?p=preview

thank you

@MarkRBM
Copy link

MarkRBM commented Jan 28, 2015

+1 are you supposed to be able to be able to populate the model from outside of the directive?

@MarkRBM
Copy link

MarkRBM commented Jan 28, 2015

possibly related to this #256

@eago99
Copy link
Author

eago99 commented Jan 28, 2015

Hi don't think its the same issue. I have no problem tracing the property I want from the object. The problem is with populating.
I think it should be possible to populate outside the directive, otherwise you can use the control only to create objects but not to edit already existing ones like when loading data from a database,
When no multiselect is used populating works fine

@antony
Copy link

antony commented Feb 11, 2015

I have the same problem. I use the field to select a fresh value, and then I have an edit page which I can provide with:

The entire selected object - problematic because when you select a value using the control itself, it only populates the id.

The id alone - problematic because you can't see the human readable detail of the selected item, you just see a blank box.

Whichever way you look at it, it fundamentally doesn't work, and requires manual massaging of the values to get it to work - and even then you need to run any automatically triggered (on-select) methods manually. My controller is now a total mess, and it still doesn't work because pre-populating the ajax-fetched data from the model stops it refreshing when the dropdown is clicked.

I've spent a day on it, and I'm now looking to replace the component because it doesn't seem to be able to do something quite fundamental - i.e. allow editing of previous data - which is a real showstopper.

What I think is needed is a method of triggering a 'select' using data from ajax calls to re-populate the controls as if done by a user. But I can't see a way to do this.

@ndikan
Copy link

ndikan commented Feb 25, 2015

This actually used to work for me in 0.9.7 and prior--setting the model value directly. Oddly, if i set it twice, it sometimes works. It's like a watch is not firing correctly.

@ndikan
Copy link

ndikan commented Feb 26, 2015

~~I forked @eastdacc 's plunker and updated the select.js version to 0.9.9 and changed the model value to a string array instead of the entire object, with a corresponding 'person.name as person in people' change in ui-select-choices repeat. It should hopefully highlight a very similar issue to @eastdacc 's.

http://plnkr.co/edit/spxeBT7fZBijUweiOYV3?p=preview

@cmartin81
Copy link

I got the same problem. It works perfect when I the array is populated, but not when it is empty.
+1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants