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

Bind List to Client-cached JSON array

1 Answer 242 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Eric J at FADV
Top achievements
Rank 1
Eric J at FADV asked on 27 Aug 2014, 04:39 PM
What is the best way of doing local binding of a DropDownList (or ComboBox) to a cached JSON array, e.g. a collection of data items cached in localStorage?

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 29 Aug 2014, 11:02 AM
Hello,

You have several options pretty much equivalent to do this.

var localStorageItems = // get the items or parse them however the logic is
  
//option 1
var dataSource = localStorageItems ;
  
//option 2
var dataSource = {
      data: localStorageItems
};
  
//option 3
var dataSource = {
      transport: {
              read: function(e) {
                     e.success(localStorageItems);
               }
      }
};
  
  
$("#myDropDOwnList).kendoDropDownList({
        dataSource: dataSource
       //other options
});

Even more examples are available in the documentation here:

http://docs.telerik.com/kendo-ui/api/framework/datasource

Kind Regards,
Petur Subev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
DropDownList
Asked by
Eric J at FADV
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or