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

Select doesn't support string as status.value #761

Open
sinall opened this issue Nov 7, 2019 · 5 comments
Open

Select doesn't support string as status.value #761

sinall opened this issue Nov 7, 2019 · 5 comments

Comments

@sinall
Copy link

sinall commented Nov 7, 2019

The model uses string value, not int or bool.

Here's the sample code:
http://jsfiddle.net/o0Lfh3bq/5/

When editing, the current model value is not selected.
The issue is similar to #752

@ckosloski
Copy link
Contributor

If you remove the track by it works correctly
https://jsfiddle.net/ckosloski/kby2839c/4/

@sinall
Copy link
Author

sinall commented Nov 9, 2019

OK, do you want to rename the title?

@ckosloski
Copy link
Contributor

Does removing the track by not work for you?
The radiolist issue that was fixed, was fixed in xeditablebecause there was code in xeditable that was not correct.
There really isn't any code in xedtiable for selects. Only code for placeholder and multiple select
https://github.com/vitalets/angular-xeditable/blob/master/src/js/directives/select.js

It is just the angular select that ends up getting used.

@sinall
Copy link
Author

sinall commented Nov 10, 2019

Yes it works. It just doesn't work with track by.
Angular could work with track by, but the model have to be entire object as in ng-options:
http://jsfiddle.net/psaovgx2/8/
However, when you select status2 first time, it becomes blank. Seems that the model have to be exactly same as one of the object in ng-options.

I'm not sure if we can create a temporary object based on user.status and use it internally? Then it could behave the same as radiolist.

Another way is using ng-selected, but it only works on <option>.
FYI: How to have a default option in Angular.js select box

@ckosloski
Copy link
Contributor

Xeditable already makes a copy.
I'm not seeing anything obvious on what to fix. I tried a few things and couldn't figure anything out.
Feel free to open a PR if you can figure out a fix.

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

No branches or pull requests

2 participants