如何根据复选框在文本字段中显示文本?

时间:2015-02-12 19:16:24

标签: angularjs kendo-ui

一旦使用复选框从树视图列表中选择了多个值,我希望所有选定的值文本显示在文本字段中并关闭树视图。我是Angularjs中的新用户将会感激。

这是我到目前为止所做的......

HTML

 <input type="text" class="form-control" id="legalEnty"
                        ng-readonly="readOnly" ng-model="nonPersistentProcess.legalEnty"
                        data-toggle="dropdown" data-target="#" placeholder="LegalEntity"
                        ng-maxlength=100 required ng-click="showLegalEntityTreeView = {display: 'block' }"
                        data-required-msg="Legal Entity is required" name="legalEnty">

rating.js

var legalEntiryOptionsDataSource;

    $scope.treeOptions = {
      checkboxes: true,
      dataBound: function(e) {
        $scope.attachChangeEvent(e);
      }
    };

    $scope.attachChangeEvent = function(e) {
      var dataSource;
      dataSource = e.sender.dataSource;
      dataSource.bind('change', function(e) {
        var checkedNodes, i, nd, selectedNodes;
        selectedNodes = 0;
        checkedNodes = [];
        $scope.checkedNodeIds(dataSource.view(), checkedNodes);
        i = 0;
        while (i < checkedNodes.length) {
          nd = checkedNodes[i];
          if (nd.checked) {
            selectedNodes++;
          }
          i++;
        }
        $scope.nonPersistentProcess.legalEnty = selectedNodes;
      });
    };


    legalEtityTreeOptions = TreeViewData.query({ id: 'LEGAL_ENTITY' }, function () {
      $scope.legalEntiryOptionsDataSource = new kendo.data.HierarchicalDataSource({ data: legalEtityTreeOptions });
    });

    $scope.itemLegEntyTemplate = '<a ng-click="selectLeglEntyTree(this)" class="no-style">{{dataItem.text}}</a>';

    $scope.selectLeglEntyTree = function(object) {
      $scope.nonPersistentProcess.legalEnty = object.dataItem.text;
      $scope.processDTO.legalEnty = object.dataItem.id;
      $scope.showLegalEntityTreeView = {
        display: 'none'
      };
    };

0 个答案:

没有答案