如何设置listview kendoui中选择的第一个项目

时间:2015-04-10 11:51:32

标签: asp.net-mvc vb.net listview kendo-ui-mvc

#:CustomerVersion#         #:秩#         #:帐户类型#     

默认情况下,应在加载页面时选择第一个列表项。怎么做到这一点?

enter image description here

<script type="text/x-kendo-tmpl" id="template">
  <div class="product">
    <h3>#:CustomerVersion#</h3>
    <h5>#:Rank#</h5>
    <h3>#:AccountType#</h3>
  </div>
</script>


<div class="demo-section">
  @Code Dim listName = "List" Dim listViewRankBar = Html.Kendo().ListView(Of RankBarModel)() With listViewRankBar .Name(listName) .TagName("div") .ClientTemplateId("template") .DataSource(Sub(datasource) datasource.Read(Sub(read) read.Action("Products_Read",
  "RankBar")) datasource.PageSize(15) End Sub) .Selectable(Sub(selectable) selectable.Enabled(True) selectable.Mode(ListViewSelectionMode.Single) End Sub) .Events(Sub(events) events.Change("onChange").DataBound("onDataBound") End Sub) '.Pageable() End
  With End Code @listViewRankBar
</div>

1 个答案:

答案 0 :(得分:1)

&#13;
&#13;
 function listRankBarOnDataBound(arg) {
   //Fires when the list view has received data from the data source and it is already rendered.
   // get a reference to the list view widget
   var listView = $("#ListRankBar").data("kendoListView");
   // selects first list view item
   listView.select(listView.element.children().first());
 }
&#13;
&#13;
&#13;