分组概述
DropDownList使您能够将其绑定到分组数据源。
要对数据进行分组,需要定义一个组数据源
表达式,该表达式使用自定义数据源配置,并指定将对DropDownList进行分组的字段。有关可运行示例,请参阅演示如何在下拉列表中分组。
数据源按升序或降序对分组数据进行排序。要持久化特定的组顺序,请使用服务器分组功能。来定义
servergroup中
选项,使用servergroup中
方法。
下面的示例演示如何按国家对DropDownList中的数据进行分组。
@(Html.Kendo(). dropdownlist (). name ("customers") . datasource (source => source . custom (). group (g => g. add ("Country", typeof(string))) . transport (transport => transport . read (read => {read. text => {read. text => {read. text =>})行动(“Grouping_GetCustomers”,“它”);})) .DataTextField("ContactName") .DataValueField("CustomerID"))