Hello,
I defined a custom "required" binding with kendo.data.binders :
kendo.data.binders.required = kendo.data.Binder.extend({
init: function(element, bindings, options) {
Kendo.data.Binder.fn.init.call(this, element, bindings, options);
},
refresh: function() {
var required = this.bindings['required'].get();
$(this.element).prop('required', !!required);
if($(this.element).getKendoUpload()) console.log('required changed');
}
});
And my input file :
<input type="file" data-role="kendoUpload" name="file0" data-bind="required: myCheckFunction">
The console.log display "required changed" correctly but after calling the clearAllFiles/clearFile/removeAllFiles/removeFile method of the kendo upload widget, the log is no longer displayed because "this.element" is undefined.
What the problem ?
I tried to define the required binding in kendo.data.binders.widget.required instead of kendo.data.binders.required but, I don't know why, even if the input is a widget, the event binding is called in the kendo.data.binders.required.
Thanks a lot.
moosh
I defined a custom "required" binding with kendo.data.binders :
kendo.data.binders.required = kendo.data.Binder.extend({
init: function(element, bindings, options) {
Kendo.data.Binder.fn.init.call(this, element, bindings, options);
},
refresh: function() {
var required = this.bindings['required'].get();
$(this.element).prop('required', !!required);
if($(this.element).getKendoUpload()) console.log('required changed');
}
});
And my input file :
<input type="file" data-role="kendoUpload" name="file0" data-bind="required: myCheckFunction">
The console.log display "required changed" correctly but after calling the clearAllFiles/clearFile/removeAllFiles/removeFile method of the kendo upload widget, the log is no longer displayed because "this.element" is undefined.
What the problem ?
I tried to define the required binding in kendo.data.binders.widget.required instead of kendo.data.binders.required but, I don't know why, even if the input is a widget, the event binding is called in the kendo.data.binders.required.
Thanks a lot.
moosh