asp.net mvc 4 - how do you bind the MVC 4 data result of a function to a kendo ui ListView? -


i have result of jsonresult method returns bunch of data including list of images. i'd use part of result (the list of images) datasource listview. data comes jsonresult method fine. if use alert(data.travelerimages[x]) in js, expect; when try use data.travelerimages datasource, seem nothing.

the order of operations follows:

  1. index page loads view jasonresult data populating fields - works.
  2. i check list of images populated correct data - works.
  3. i use list of images datasource listview - not work.

here listview, notice set no datasource because can't until list of images return jsonresult method:

        <div class="divtraveler_image">         @*<img id="travelerimage" class="traveler_image" />*@         @(html.kendo().listview<datasourceresult>()                 .name("lvtravelerimages")                 .tagname("divimagelistview")                 .clienttemplateid("template")                 .pageable()                 .selectable(selectable => selectable.mode(listviewselectionmode.multiple))              )         </div> 

here's attempting bind listview (this occurs in success function of jquery method:

 var lvtravelerimagedata = new kendo.data.datasource({ data: data.travelerimages });    //alert(data.travelerimages[0]) // works great    $('#lvtravelerimages').kendolistview({        datasource: lvtravelerimagedata,     });   lvtravelerimagedata.read(); 

this part shows nothing except empty listview. appreciated. bunch.

you initializing listview second time instead of getting client object. should object follows , use setdatasource method.

e.g.

var lvtravelerimagedata = new kendo.data.datasource({ data: data.travelerimages });    //alert(data.travelerimages[0]) // works great    $('#lvtravelerimages').data("kendolistview").setdatasource(lvtravelerimagedata);    lvtravelerimagedata.read(); 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -