javascript - Filtering in Telerik Kendo Multiselect -


hi have simple select in mvc view....

<select id="msproducts" multiple style="width:100%;"></select> 

which converted kendo multiselect using javascript/jquery

$(document).ready(function () {          //products multi-select         $("#msproducts").kendomultiselect({             placeholder: "select product(s)",             datatextfield: "productnametext",             datavaluefield: "productnamevalue",             datasource: {                 type: "json",                 serverfiltering: true,                 transport: {                     read: {                         url: "home/products"                     }                 }             }         });  }); 

my contoller has:

'get: home/products <httpget> function products() jsonresult     dim diaryproductlist list(of productsmodel) = productsmodel.getproducts     return json(diaryproductlist , jsonrequestbehavior.allowget) end function 

my productsmodel class is:

public class productsmodel      public property productnametext string      public property productnamevalue string      public shared function getproducts() list(of productsmodel)         dim productlist = new list(of productsmodel)         dim dc new dbdatacontext         try             dim productsquery = (from pin dc.products                                 p.productstatus <> "discontinued"                                 select new {.productnamevalue = p.productname,                                     .productnametext = p.productname}).orderby(function(lst) lst.productnamevalue)             each r in productsquery                 productlist.add(new productsmodel() {.productnamevalue = r.productnamevalue,                                   .productnametext = r.productnametext})                 next             catch ex exception                 productlist.add(new productsmodel() {.productnamevalue = "",                                   .productnametext = ex.message})                             dc.connection.close()             end try             return productlist     end function end class 

my problem although muti-select gets populated (with 5000+ products) dropdown not filtering user types. example if beging typing word cake. type c i-beam disappears , after second or 2 dropdown drops brief moment , disappears clearing multi-select completely. way can populate @ moment type letter a, wait , scroll through complete list , select need, repeating each item need. have missed something? should introduce paging in order limit data?

thanks

based on links provided ademar i've changed code have following works....

//products multi-select       // ms datasource     var ms_datasource = new kendo.data.datasource({         transport: {             read: {                 url: "home/products",                 type: "get",                 datatype: "json"             }         },         schema: {             model: {                 fields: {                     "productname": {                         type: "string"                     }                 }             }         }     });      // ms widget options     var ms_options = {         autobind: false,         minlength: 4,         maxselecteditems: 25,         datatextfield: "productname",         datavaluefield: "productname",         filter: "contains",         placeholder: "select product(s)",         datasource: ms_datasource     };      // create ms widget     $("#msproducts").kendomultiselect(ms_options); 

i have amended product class give list of product names use both tag text , value in multiselect.


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -