-
Notifications
You must be signed in to change notification settings - Fork 1
-
Notifications
You must be signed in to change notification settings - Fork 1
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
add binding mechanism #20
Comments
open questions:
|
implemented changes from #20 comment here: #20 (comment)
pertains to siq/gloss#20 i plan to replace both the siq/mesh Model and siq/gloss Widget `set` functionality with this mixin.
pertains to siq/gloss#20
pertains to siq/gloss#20
pertains to siq/gloss#20
what used to be Class.prop is now Class.nestedProp, and the Model class from siq/mesh uses the Settable mixin. pertains to #20
pertains to #20 i was making the assumption that all grids were backed by models, this is not always the case... though maybe it should be...
pertains to siq/gloss#20
this has been implemented, so i'm going to close this issue. there's still some work to be done before this is really useful though. we'd want to add some kind of mixin for convenience, which would allow us to do something like:
and then the big thing would be handling the results of a call to |
bind DOM elements to model fields
overview
the easiest way to explain is to start off with some examples
explicit binding
whenever
myModel.myModelField.subField
changes, theinnerText
of$el
will be updated with its new value. this is a one-way binding.automatic binding to some fields in an HTML snippet
where
$someHtml
refers to markup of this structure:then whenever
myModel.field1
andmyModel.field2
change, theinnerText
of their corresponding<span>
elements will be updated.this is also a one-way binding.
automatic binding to a widget instance
where
$userForm
refers to something like this:in this case, since the
<input>
elements will be instances ofFormWidget
, they will be bound to their correspondingfields in
myUserModel
. these will be 2-way bindings.further details for automatic binding
automatic binding algorithm works as follows:
HTMLElement
instance, jQuerycollection, or
Widget
instance),data-bind
attribute, if found, set up aone-way binding between the element and the field specified by the
attribute
data-bind
attr, check if the element corresponds to aninstance of
FormWidget
, if so, set up a two-way binding between thewidget and the model field corresponding to the widget's element's
'name' attribute
The text was updated successfully, but these errors were encountered: