powmedia / backbone-forms

Form framework for BackboneJS with nested forms, editable lists and validation
MIT License
2.17k stars 413 forks source link

Suggestion Select editor setOptions() should also store them #429

Open robert2d opened 10 years ago

robert2d commented 10 years ago

When calling a Select editors setOptions() method it never actually stores these options on the field as an object.

Either you do this manually via editor.schema.options = "new options",

or you have to trawl through the actual dom and pick out the select editors options using jQuery this.$el.find("option") and then map of the values needed.

I suggest changing the setOptions method, to "re-set" the schemas options. This way you can pick the raw options off the editor when using event listeners etc.. Maybe a utility function for retrieving the selects options without hitting the DOM could be a part of the editor.

https://github.com/powmedia/backbone-forms/blob/master/src/editors/select.js#L52

philfreo commented 10 years ago

Sort of related to #274