2015-04-02 57 views
0

出现两次使用UI-Grid的cellTemplate在选择这样的:AngularJS - UI网格CellTemplate按钮滚动

field: 'isHflrReplaceable', displayName: 'Lead Replacement', width: 200, enableSorting: false, cellTemplate: hflrTemplate 

模板看起来是这样的:

var hflrTemplate = '<div class="ui-grid-cell-contents">' 
         + '<span class="hflr" ng-show="(row.entity.creditStatus == \'Credit Accepted\') || (row.entity.creditStatus == \'Credit Rejected\')">{{row.entity.creditStatus}}</span>' //IF status = Credit accepted or Rejected 
         + '<span class="hflr" ng-show="(row.entity.creditStatus == \'Credit Pending\') && (row.entity.isHflrReplaceable == 1)"><button ng-if="row.entity.isHflrReplaceable == 1" ng-click="grid.appScope.setSelected(row.entity);" type="button" class="btn btn-default btn-xs" data-toggle="modal" data-target="#HFLRModal"><span class="fa fa-reply m-r-xs"></span>View/Edit</button></span>' //IF status = Credit Pending && can return 
         + '<span class="hflr" ng-show="(row.entity.creditStatus == null) && (row.entity.isHflrReplaceable == 1)"><button ng-if="row.entity.isHflrReplaceable == 1" ng-click="grid.appScope.setSelected(row.entity);" type="button" class="btn btn-primary btn-xs" data-toggle="modal" data-target="#HFLRModal"><span class="fa fa-reply m-r-xs"></span>Request Replacement</button></span>' //IF status = null && can return 
         + '</div>'; 

正确的项目显示为预期。这个清单有点长〜200行左右。

当我向上滚动一些长度通过视口,然后备份时,只包含文本的模板跨度很好。但是,模板跨度显示按钮具有相同按钮的附加副本。事实上,随着我滚动离开按钮,然后回到按钮,按钮不断添加。我检查了DOM,每次滚动到按钮时,都会有一个额外的按钮。到底他妈发生了什么?

注意:我不操纵任何数据,我只是用滚动条滚动表格视图。

回答

0

没关系。虚惊。

看起来像某人在按钮本身中添加了ng-if。我不知道为什么。并从按钮标签本身中删除,解决了问题。