Kendo多选下拉列表未显示值

时间:2016-06-09 00:06:01

标签: javascript jquery angularjs kendo-ui telerik

我尝试使用示例将值绑定到Kendo多选下拉列表但无法在下拉列表中显示数据。

Tried to use this example in Kendo

My trails are here

numberList=[16,19,42,43,74,66]

largest = numberList[0]

for num2 in numberList:

    if num2 > largest:

        largest=num2

print(largest)

2 个答案:

答案 0 :(得分:1)

这是我使用kendoUI multiselect的方式

<select kendo-multi-select k-options="selectOptions" k-ng-model="selectedIds" required></select>


$scope.selectOptions = {
                placeholder: "Select DimLinks...",
                dataTextField: "LINK_NAME",
                dataValueField: "PK_DIM_LINK",
                valuePrimitive: true,
                autoBind: false,
                dataSource: {
                    serverFiltering: true,
                    transport: {
                        read: {
                            url: "api/DimLinks",
                        }
                    }
                }
            };
            $scope.selectedIds = [4, 7];

看看这是否有帮助。

答案 1 :(得分:0)

我做了更多研究并尝试了很多选项,并且在某些方面我可以展示项目。 希望这对正在寻找类似解决方案的其他人有用。

<!DOCTYPE html>
<html>
<head>
    <base href="http://demos.telerik.com/kendo-ui/multiselect/angular">
    <style>html { font-size: 14px; font-family: Arial, Helvetica, sans-serif; }</style>
    <title></title>
    <link rel="stylesheet" href="//kendo.cdn.telerik.com/2016.2.607/styles/kendo.common-material.min.css" />
    <link rel="stylesheet" href="//kendo.cdn.telerik.com/2016.2.607/styles/kendo.material.min.css" />

    <script src="//kendo.cdn.telerik.com/2016.2.607/js/jquery.min.js"></script>
    <script src="//kendo.cdn.telerik.com/2016.2.607/js/angular.min.js"></script>
    <script src="//kendo.cdn.telerik.com/2016.2.607/js/kendo.all.min.js"></script>
</head>
<body>
<div id="example" ng-app="KendoDemos">
    <div class="demo-section k-content" ng-controller="MyCtrl">

        <h4>Select Names</h4>


      <select id="name" kendo-multi-select ng-model="data.names" k-data-source="IDSAPIFieldsDataSource" k-option-label="{name: 'Name'}" k-options="nameOptions" style="width:200px"></select>

    </div>
</div>

<script>
  angular.module("KendoDemos", [ "kendo.directives" ])
    .controller("MyCtrl", function($scope){        
      $scope.IDSAPIFieldsDataSource = new kendo.data.DataSource({
        data: [{ name: 'Abc' }, { name: 'Def' }]
      });

            $scope.nameOptions = {
      placeholder: "Select",
      dataSource: $scope.IDSAPIFieldsDataSource ,
      dataTextField: "name",
      dataValueField: "name",
      valuePrimitive: true,
      autoBind: false
            }  
      })
</script>


</body>
</html>