Databinder : element undefined after calling clearAllFiles with kendoUpload

3 posts, 0 answers
  1. moosh
    moosh avatar
    9 posts
    Member since:
    Aug 2019

    Posted 27 Jul 2020 Link to this post

    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
  2. moosh
    moosh avatar
    9 posts
    Member since:
    Aug 2019

    Posted 27 Jul 2020 Link to this post

    Little precision.

    Calling the clearAllFiles/clearFile/removeAllFiles/removeFile method of the kendo upload widget OR clicking on the cross icon next to the file in the file list, generate the problem.

  3. Ivan Danchev
    Admin
    Ivan Danchev avatar
    2184 posts

    Posted 28 Jul 2020 Link to this post

    Hello Moosh,

    While it is possible to extend the functionality of the widgets, to achieve something that is not available out-of-the-box, we don't support this officially. I'll leave this thread open, in case someone from the community has implemented required binding in the Upload and could provide more insight.

    Alternatively, we have a Professional Services team that specializes in extending widgets and source code modifications aimed at creating custom behavior.

    Regards,
    Ivan Danchev
    Progress Telerik

Back to Top