【问题标题】:Set the returned data to Kendo Dropdownlist将返回的数据设置为 Kendo Dropdownlist
【发布时间】:2016-11-07 06:17:55
【问题描述】:

我在 ASP.Net MVC 中工作。我有一个剑道下拉列表和一个表单,用于将数据插入数据库并设置最近插入的数据以在剑道下拉列表中选择。我正在使用 Angular 发布方法。

var response = $http({
                method: "post",
                url: loadAllProductsUrl,
                data: JSON.stringify(customerdetail),
                dataType: "json",
                async: false
            });

            $('#customerModal').modal('hide');
            return response.then(function (data) {
                if (data != null) {
                    $("#customers").data("kendoDropDownList").dataSource.read();
                    setToDropdown(data);

                }
                else {

                }
            });

这是我的 Post 方法,我从这里返回客户代码并将其设置到剑道下拉列表中。

function setToDropdown(data) {

            var temp = $("#customers").data("kendoDropDownList");
              temp.select(function (dataItem) {
                  return dataItem.CustomerCode === data;
              });
        }

但是数据没有被设置到下拉列表,因为 setToDropdown(data) 在 $("#customers").data("kendoDropDownList").dataSource.read(); 之前执行已满载。请建议....

【问题讨论】:

    标签: asp.net angularjs asp.net-mvc asp.net-mvc-4 kendo-asp.net-mvc


    【解决方案1】:

    这对我有帮助

     getCustomer(function (a) {
    
                                setTimeout(function () {
    
                                    $("#customers").data("kendoDropDownList").value(data.CustomerName);
                                }, 100);
    
                            });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-07-29
      • 1970-01-01
      • 2014-03-28
      • 1970-01-01
      • 1970-01-01
      • 2020-09-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多