How to disable "select a file" button in Kendo Upload

6 posts, 0 answers
  1. Silver Lightning
    Silver Lightning avatar
    44 posts
    Member since:
    Feb 2014

    Posted 18 Jun 2014 Link to this post

    Hi to all,

    Great day.

    Just would like to ask on how could I disable the "select a file" button in Kendo Upload?
    During the process of my uploading, the user can still click the select a file even still in process.

    I hope someone could help me on this.

    Highest gratitude in advance.

  2. Silver Lightning
    Silver Lightning avatar
    44 posts
    Member since:
    Feb 2014

    Posted 18 Jun 2014 in reply to Silver Lightning Link to this post

    I got it. Thanks
  3. Kendo UI is VS 2017 Ready
  4. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2159 posts

    Posted 18 Jun 2014 Link to this post

    Hello Jesureno,


    In the current scenario you could use the Upload widget events:
        - upload event to disable the widget when an upload starts.
        - complete event to enable it again.
    E.g.

    function onComplete(e) {
        this.enable();
    }
     
    function onUpload(e) {
        this.disable();
    }

    I hope this information helps.

    Regards,

    Dimiter Madjarov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  5. Silver Lightning
    Silver Lightning avatar
    44 posts
    Member since:
    Feb 2014

    Posted 18 Jun 2014 in reply to Silver Lightning Link to this post

    Sorry for being too agressive, just would like to ask only on how could I disable the select file button in Kendo Upload,

    I made some code but this is not the requirements on my module

    Here's my sample code:

      function getUpload() {
            return $("#files").data("kendoUpload");
        }

    on upload event, I used the function getUpload

         upload: function (e) {
                     getUpload().disable();
                     e.data = { selectedTable: $("#ComboLookupTable").val() };
                },

    but the whole upload control became disable, I only need is to disable the "select a file" button during upload processing.

    I hope someone could help me.

    Thank you and God bless.

  6. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2159 posts

    Posted 18 Jun 2014 Link to this post

    Hi Jesureno,


    Here is a sample approach to disable and enable the select button, using the upload and complete events.
    E.g.
    function complete(e) {
        this.element.prop("disabled", false);
        this.element.closest(".k-button").removeClass("k-state-disabled");
    }
     
    function upload(e) {
        this.element.prop("disabled", true);
        this.element.closest(".k-button").addClass("k-state-disabled");
    }

    As a general advise the widget instance could be accessed via this keyword in the event handlers.

    Regards,
    Dimiter Madjarov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  7. Silver Lightning
    Silver Lightning avatar
    44 posts
    Member since:
    Feb 2014

    Posted 18 Jun 2014 in reply to Dimiter Madjarov Link to this post

    Thank you Dimiter....
Back to Top
Kendo UI is VS 2017 Ready