Skip to content

I think the parse method needs an else at the end #235

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

Open
weisborg opened this issue Dec 15, 2016 · 1 comment
Open

I think the parse method needs an else at the end #235

weisborg opened this issue Dec 15, 2016 · 1 comment

Comments

@weisborg
Copy link

weisborg commented Dec 15, 2016

There isn't anything currently when calling refresh(which calls parse) to clear the current selection if the new options don't have a selected option or the value that was there isn't in the list anymore.

It needs something like this at the end:

this.map = map;
if (selected) {
	this.$element.val(selected);
	this.$target.val(selectedValue);
	this.$container.addClass('combobox-selected');
	this.selected = true;
}
else {
	this.$element.val('');
	this.$target.val('');
	this.$container.removeClass('combobox-selected');
	this.selected = false;
}
return source;
@weisborg
Copy link
Author

The if (option.prop('selected')) probably also needs something that also compares the option text to the existing text of the combobox input to select it as well. I'm not sure how it would work or which would override the other though.

This piece didn't impact me much since I use Mustache to set a data-value in the select and after updating the select I then set the value of the select before calling refresh on the combo. To me, since refresh is building off the select it should get all details from the select, but if we add any other functionality I've been seeing requested like allowing values not in the list and such it would be needed.

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

1 participant