打赏

kendo 级联加带搜索的下拉框以及js赋值

1‘、js给下拉框赋值

$("#UserRole").data("kendoDropDownList").value(dataItem.RoleName);


$('#MultiSelectMachineMasterTypes').data('kendoMultiSelect').dataSource.read();
$("#MultiSelectMachineMasterTypes").data("kendoMultiSelect").value(arr0);

  

2、实现storeId根据customerCode级联,而且storeId下拉框在输入时进行筛选

 

        @Html.RequiredIndicatorLabelFor(m => m.StoreId, new { @class = "col-sm-2 control-label no-padding-right" })
            <div class="col-sm-2">
                @(Html.Kendo().DropDownListFor(m => m.StoreId)
                              .Name("StoreId")
                              .OptionLabel("请选择")
                              .DataTextField("StoreName")
                              .DataValueField("Id")
                              .MinLength(3)
                              .HtmlAttributes(new { style = "width:100%" })
                              .Template("#= StoreName #")
                              .Height(290)
                              .Filter(FilterType.Contains)
                              //.CascadeFrom("CustomerId")
                              .DataSource(source =>
                              {
                                  source.Custom()
                                      .ServerFiltering(true)
                                      .ServerPaging(true)
                                      .PageSize(8000)
                                      .Type("aspnetmvc-ajax")
                                      .Transport(transport =>
                                      {
                                          transport.Read(read =>
                                          {
                                              read.Action("LoadStoreByCustomerCode", "EquipmentOrderManage")
                                                  .Data("getCustomerIdFilter");
                                          });
                                      })
                                      .Schema(schema =>
                                      {
                                          schema.Data("Data")
                                              .Total("Total");
                                      });
                              })
                )
                @Html.ValidationMessageFor(m => m.StoreId)
            </div>
        function getCustomerIdFilter() {
            return {
                id: $("#CustomerId").val()
            };
        }

 

public ActionResult LoadStoreByCustomerCode([DataSourceRequest] DataSourceRequest request)
{
  return Json(_commonService.GetStores();.ToDataSourceResult(request));
}

 

posted @ 2016-11-18 12:06  KiteRunner1988  阅读(1300)  评论(0编辑  收藏  举报