backbone.epoxy icon indicating copy to clipboard operation
backbone.epoxy copied to clipboard

Custom inputs or widgets for value binding

Open houpli opened this issue 10 years ago • 1 comments

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

houpli avatar Apr 16 '15 22:04 houpli

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();
            }
        }

markerikson avatar Apr 22 '15 21:04 markerikson