【问题标题】:AngularJS Kendo Treeview not updatingAngularJS Kendo Treeview 没有更新
【发布时间】:2014-03-23 06:57:02
【问题描述】:

感谢Angularjs + kendo-ui treeview 的“Words Like Jared”的回答,我的树形视图正常工作,一切都很好。直到 - 有人想根据复选框等更新/过滤树视图。我的问题是树没有更新以反映控制器中数据源的变化。

基于上述答案中的 jsfiddle,我创建了一个来显示我的问题。

http://jsfiddle.net/rajeshmathew/LwDs5/

if ($scope.showLimitedRecords) {                    
$scope.thingsOptions = {dataSource: $scope.things2}                    
} else {
$scope.thingsOptions = { dataSource: $scope.things1 };                                        
}

选中复选框不会影响树。 我是 AngularJS 和 angular-kendo 的新手,我想知道这种更新是否应该有效。我可能会走错路。非常感谢任何帮助/建议。

谢谢!

【问题讨论】:

    标签: angularjs kendo-ui angular-kendo


    【解决方案1】:

    您可以显式创建数据源,然后使用其 API 设置数据:

    $scope.thingsOptions = {
        dataSource: new kendo.data.HierarchicalDataSource({
            data: $scope.things1
        })
    }
    $scope.toggleFlag = function () {
        if ($scope.showLimitedRecords) {
            $scope.thingsOptions.dataSource.data($scope.things2);
        } else {
            $scope.thingsOptions.dataSource.data($scope.things1);
        }
    }
    

    (updated demo)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-20
      • 1970-01-01
      • 1970-01-01
      • 2015-01-01
      相关资源
      最近更新 更多