Data binding
onPreDataBind fires before a data-bound input updates the underlying value, useful for
validation. The handler receives { templateItem, field, dataBind, cancelToken },
field is the input element, dataBind is a function you can call to trigger the
bind yourself and cancelToken governs whether the default automatic bind happens.
$bindary.onPreDataBind.add(function (args)
{
if (args.field.value.length > 100)
args.cancelToken.cancel = true; // reject: value is not applied
});
onPostDataBind fires after binding is applied, receiving
{ templateItem, field, model, value }, the data object the value was set on and the value
itself.
I'd previously documented these as taking positional arguments, (item, element, apply),
based on how core.fireEvent('preDataBind', [item, el, fn]) is called internally in
Renderer.js. This typedef says listeners receive a single named object instead. The two
aren't necessarily in conflict, fireEvent may wrap the positional internals into this object
before dispatching to listeners, but I haven't directly confirmed that wrapping step, only the two ends
of it. Worth a quick check before relying on the exact property names above.