backbone.epoxy
backbone.epoxy copied to clipboard
Custom inputs or widgets for value binding
Hi,
I use custom inputs widgets like DatePicker or NumericTextBox (KendoUI). I would like to use "value" binding but I have to create my custom handler with addHandler.
Is it possible ?
Thank you
Seems like that's exactly what custom handlers are intended for - creating binding interactions that aren't "standard". I've done exactly that myself with some jQuery plugins, like this one for jQuery-Knob:
// Gets/sets the value for a $.knob() element
knobValue : {
set : function($element, value) {
// Note that this does NOT appear to retrigger the knob's "change" handler, and
// therefore we don't get into an infinite loop
$element.val(value).trigger("change");
},
get: function( $element, value, event ) {
return $element.val();
}
}