Disable, Enable and rebind the DropDownList

3 Answers 19952 Views
DropDownList
Suthish
Top achievements
Rank 2
Suthish asked on 15 Jun 2015, 04:57 AM

Hi,

I tried to disable and enable the DropDownList control. But after enabling again, the data seems to lost or not rebinding again.

 

disabled

$("#dropdownlist").kendoDropDownList({
  enable: false
});

 

enabled

$("#dropdownlist").kendoDropDownList({
  enable: true
});

 

Here its get enabled again, but data not listing?

3 Answers, 1 is accepted

Sort by
1
Plamen Lazarov
Telerik team
answered on 16 Jun 2015, 11:27 AM

Hello Suthish,

The right way to enable or disable a DropDownList is to get an instance of the widget and use its enable() method. 

var dropdownlist = $("...").data("kendoDropDownList");
dropdownlist.enable(false);
dropdownlist.enable(true);

Using the code below twice is not recommended since it re-initializes the widget.

$("#dropdownlist").kendoDropDownList({
  
});


 

Regards,
Plamen Lazarov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Suthish
Top achievements
Rank 2
answered on 15 Jun 2015, 05:37 AM

This worked, not sure whats the difference...

disable

var dropdownlist = $("#period").data("kendoDropDownList");
dropdownlist.enable(false);

 

enable
dropdownlist.enable(true);

 

 

John
Top achievements
Rank 2
Iron
Iron
Veteran
commented on 20 Oct 2021, 01:33 PM

the difference is you are referencing an existing one vs creating one.

 

0
Alexander Popov
Telerik team
answered on 16 Jun 2015, 12:13 PM

Hello Suthish,

The right way to enable or disable a DropDownList is to get an instance of the widget and use its enable() method. 

var dropdownlist = $("...").data("kendoDropDownList");
dropdownlist.enable(false);
dropdownlist.enable(true);

Using the code below twice is not recommended since it re-initializes the widget.

$("#dropdownlist").kendoDropDownList({
  
});


 

Regards,
Telerik Team
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
DropDownList
Asked by
Suthish
Top achievements
Rank 2
Answers by
Plamen Lazarov
Telerik team
Suthish
Top achievements
Rank 2
Alexander Popov
Telerik team
Share this question
or