角UI网的分组报头 [英] angular ui-grid grouping header

查看:194
本文介绍了角UI网的分组报头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让组头将显示为cellTemplate,这是我使用的模板:

i am trying to make the group headers to be shown as the cellTemplate, this is the template i use:

<div class="ui-grid-cell-contents">
    <div ng-show="COL_FIELD">
        <i class="ace-icon fa fa-check bigger-110 green"></i>
    </div>
    <div ng-hide="COL_FIELD">
        <i class="ace-icon fa fa-times bigger-110 red"></i>
    </div>
</div>

和这是columnDefs:

and this is the columnDefs:

{ 
    name:'active', 
    width: 100, 
    cellTemplate: $templateRequest('scripts/common/partials/formatter/boolean.tpl.html') 
}

这显示当前对电网的迹象,但是当我组了,它显示了2组两者有检查签到,我发现,这是因为在分组的COL_FIELD是文本,结合计数行(0(50),1(15))
这是真的
有没有设置组头当期的好办法吗?

this shows the signs currently on the grid but when i group it, it shows 2 groups both of them have the "check" sign", i found out that it happens because the COL_FIELD on grouping is text that combines the count rows (0 (50), 1 (15)) which is true is there good way to set the group header currect?

推荐答案

有中的 http://ui-grid.info/docs/#/tutorial/209_grouping ,你会在底部看到,是在分组列经营性过滤器。它调理弦索的值,然后将过滤器的部分不计,那么把字符串重新结合在一起。

There is an example in http://ui-grid.info/docs/#/tutorial/209_grouping, you'll see at the bottom a gender filter that is operating on the grouped column. It's unstringing the value, then applying the filter to the portion without the count, then putting the string back together again.

这个逻辑应用到您的cellTemplate你想要把一个函数模板,以unstring的价值,走出你想要的位:

To apply this logic to your cellTemplate you'd want to put a function in your template to unstring the value and get out just the bit you want:

<div class="ui-grid-cell-contents">
    <div ng-show="grid.appScope.checkBool(COL_FIELD)">
        <i class="ace-icon fa fa-check bigger-110 green"></i>
    </div>
    <div ng-hide="grid.appScope.checkBool(COL_FIELD)">
        <i class="ace-icon fa fa-times bigger-110 red"></i>
    </div>
</div>

您需要写的$ scope.checkBool功能做调理弦索并返回true或false。

You'd need to write the $scope.checkBool function to do the unstringing and return true or false.

如果你也想伯爵那么你需要编写一些逻辑来获取细胞的计数部分,其追加到最后。

If you also want the count then you'd need to write some logic to get the count part of the cell and append it to the end.

一些这个逻辑正在此刻,这可能会给方式,使这更容易改写。

Some of this logic is being rewritten at the moment, which may give ways to make this easier.

这篇关于角UI网的分组报头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆