This is a migrated thread and some comments may be shown as answers.

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

5 Answers 449 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Silver Lightning
Top achievements
Rank 1
Silver Lightning asked on 18 Jun 2014, 08:41 AM
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.

5 Answers, 1 is accepted

Sort by
0
Silver Lightning
Top achievements
Rank 1
answered on 18 Jun 2014, 09:00 AM
I got it. Thanks
0
Dimiter Madjarov
Telerik team
answered on 18 Jun 2014, 09:07 AM

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!
 
0
Silver Lightning
Top achievements
Rank 1
answered on 18 Jun 2014, 09:09 AM
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.

0
Dimiter Madjarov
Telerik team
answered on 18 Jun 2014, 10:00 AM
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!
 
0
Silver Lightning
Top achievements
Rank 1
answered on 19 Jun 2014, 12:41 AM
Thank you Dimiter....
Tags
Upload
Asked by
Silver Lightning
Top achievements
Rank 1
Answers by
Silver Lightning
Top achievements
Rank 1
Dimiter Madjarov
Telerik team
Share this question
or