Kendo Refresh (DropDownList.refresh()) not working ERROR Not define
Asked Answered
K

6

16

Im trying to refresh the Drop Down List after another DropDownList is Change But the Refresh() method is Undefined Error Is Promoting.There For I Tried the Read the DataSource again and it shows it loading but the data is still the same.Help to Solve this Issue please.

Code:

$("#DropDownList1").change(function () {
   custCode = $("#DropDownList1").val();

   $("#titles").data("kendoDropDownList").dataSource.read(); //shows list Loading But Same Data Is present .
   $("#titles").data("kendoDropDownList").refresh(); //NOT Working 

});
Karlkarla answered 26/8, 2012 at 18:51 Comment(0)
N
29

1- Try adding cache: false to disable the cache in Kendo DropDownList's datasource read property:

read: {
    url: <<"url">>,
    cache: false
}

2- Then call read(),

$("#ddl").data("kendoDropDownList").dataSource.read();

It worked for me :)

Nela answered 27/8, 2012 at 9:2 Comment(3)
Hi it not working for me.my data comes the problem is the kendoDropDownList shows the old data and the refresh method it undefined for some reason.Karlkarla
Note:My Drop-down is not filled by a Read . its filled by in form load.Karlkarla
Sorry Something Wrong with my Code :PKarlkarla
C
9

For me just this line did the job:

$("#myDropDownList").data("kendoDropDownList").dataSource.read();

Carranza answered 9/12, 2013 at 15:57 Comment(0)
S
2

You might find passing parameters to the ".data()" of the dataSource useful.

Example:

var myDataSource={bookId: 10, Name: "Kendo"}
$("#titles").data("kendoDropDownList").dataSource.data(myDataSource);

However, you could also try the cascadingFrom attribute of the DropDownList when you want to update one DropDownList based on the selection of another DropDownList

//Houdini

Sudden answered 15/7, 2014 at 16:54 Comment(0)
S
0

on your read url add '?myDate=' + new Date(). This will refresh the data. Without it (unless you have meta tags to prevent caching) it will give you that data it has already read.

Stokowski answered 23/3, 2015 at 22:56 Comment(0)
G
0

In my case I commented the line

//cascadeFrom: "dropdown1_id"

on the second kendo dropdown and it worked, for some reason it was messing with the data source updates.

Gambado answered 13/6, 2018 at 8:59 Comment(0)
E
0

Looks like the Kendo dropdownlist has changed. Now the answer is:

    var dataSource = new kendo.data.DataSource({
        data: my_new_json_list
    });
    var dropdownlist = $("#products").data("kendoDropDownList");
    dropdownlist.setDataSource(dataSource);

Reference: https://docs.telerik.com/kendo-ui/api/javascript/ui/dropdownlist/methods/setdatasource

Emrich answered 23/1, 2022 at 4:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.