2

下面是我需要绑定到两个剑道下拉列表的数据源。一个用于 Program,另一个用于 IForm。我需要在下拉列表本身中完成过滤。

$scope.programIFormList = new kendo.data.DataSource({
        data: [
                    {
                        Name: "Program1",
                        IsProgram: "true",
                        ProgramId: 1,
                        Status: 0,
                        PatientId: 1,
                        StartDate:"",
                        EndDate:""
                    },
                    {
                        Name: "Program2",
                        IsProgram: "false",
                        ProgramId: 2,
                        Status: 0,
                        PatientId: 1,
                        StartDate:"",
                        EndDate:""
                    }
                ]
    }); 

下面是html代码:

 <div class="col-lg-2 col-md-4 col-sm-4 col-xs-4">
                    <select id="patient" kendo-drop-down-list k-data-text-field="'Name'" k-data-value-field="'PatientId'"  k-data-source="patientList" >                      
                    </select>
                </div>

                <div class="col-lg-2 col-md-4 col-sm-4 col-xs-4">
                    <select kendo-drop-down-list k-data-text-field="'Name'" k-data-value-field="'ProgramId'" k-data-source="programIFormList | filter:{IsProgram: true}" k-cascade-from="'patient'">
                    </select>
                </div>
                <div class="col-lg-2 col-md-4 col-sm-4 col-xs-4">
                    <select kendo-drop-down-list k-data-text-field="'Name'" k-data-value-field="'ProgramId'" k-data-source="programIFormList | filter:{IsProgram: false}"  k-cascade-from="'patient'">
                    </select>
                </div>

在这里,我正在尝试应用角度过滤器。但它不起作用。如何使用 Kendo Angular 实现这一点?

4

1 回答 1

0

您可以使用这种方法

angular.module("MyApp", [ "kendo.directives" ])
      .controller("FilterController", function($scope){


          $scope.programIFormList = new kendo.data.DataSource({
              data: [
                          {
                              Name: "Program3",
                              IsProgram: "true",
                              ProgramId: 1,
                              Status: 0,
                              PatientId: 1,
                              StartDate: "",
                              EndDate: ""
                          },
                          {
                              Name: "Program1",
                              IsProgram: "false",
                              ProgramId: 2,
                              Status: 0,
                              PatientId: 1,
                              StartDate: "",
                              EndDate: ""
                          }
              ],
              filter: [
                { field: "IsProgram", operator: "eq", value: "true" }

              ]
          });
      });

于 2015-01-14T09:03:03.080 回答