How can I optimize datasource for Kendo UI Combobox with 5000 items? -


in test -> http://jsfiddle.net/olragon/642c4/12/, kendoui combobox cannot run 5000 items, how can make work without calling severside data source or limit of kendoui?

html

<h3>t-shirt fabric</h3> <input id="fabric" placeholder="select fabric..." /> 

js

/**  * returns random integer between min , max  * using math.round() give non-uniform distribution!  */ function getrandomint (min, max) {     return math.floor(math.random() * (max - min + 1)) + min; }  $(document).ready(function() {     var superdata = []     ,   data = [             { text: "cotton", value: "1" },             { text: "polyester", value: "2" },             { text: "cotton/polyester", value: "3" },             { text: "rib knit", value: "4" }         ];      for(var _i=0; _i<5000; _i++) {         var randomentry = data[getrandomint(0,data.length-1)];         randomentry.text += '-' + _i;         randomentry.value += _i;         superdata.push(randomentry);     }      // create combobox input html element     $("#fabric").kendocombobox({         datatextfield: "text",         datavaluefield: "value",         datasource: superdata,         filter: "contains",         suggest: true,         index: 3     }); }); 

update

the problem not in kendo ui combobox in loop. did check (not want do)? there error since data[getrandomint(0,data.length-1)] not return new element reference appending "_i" same 5 elements many times building long string.

try instead:

for (var _i = 0; _i < 5000; _i++) {     var randomentry = data[getrandomint(0, data.length - 1)];     var newentry = {         text: randomentry.text + '-' + _i,         value            : randomentry.value += _i     };     superdata.push(newentry); } 

check modified version of fiddle here: http://jsfiddle.net/onabai/642c4/14/


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -