Angular UI-Grid 标题单元格模板

巴尔加夫

如何使用文本和自定义样式设置标题以保持排序和过滤功能不变。

例如:

headerCellTemplate: '<div>Stone Id <b style='color: red'>*</b></div>'

这是我的 plunker:http ://plnkr.co/edit/vy4DjRuoZ48Ced0KfWRV?p=preview

谢谢。

A1t0r

在这里你可以找到 ui-grid header 的默认模板:default header cell template

所以你唯一需要做的就是随心所欲地改变。这是你想要实现的目标:http ://plnkr.co/edit/i9EFvGecvJJD9LKUBbwT?p=preview

$scope.gridOptions = {
    columnDefs: [{
      displayName: 'Name',
      field: 'name',
      headerCellFilter: 'translate',
      headerCellTemplate: 'customTemplate.html',
      enableSorting: true,

    }, {
      displayName: 'GENDER',
      field: 'gender',
      headerCellFilter: 'translate'
    }, {
      displayName: 'COMPANY',
      field: 'company',
      headerCellFilter: 'translate',
      enableFiltering: false
    }]
  };

自定义标题单元格模板

<div
  role="columnheader"
  ng-class="{ 'sortable': sortable, 'ui-grid-header-cell-last-col': isLastCol }"
  ui-grid-one-bind-aria-labelledby-grid="col.uid + '-header-text ' + col.uid + '-sortdir-text'"
  aria-sort="{{col.sort.direction == asc ? 'ascending' : ( col.sort.direction == desc ? 'descending' : (!col.sort.direction ? 'none' : 'other'))}}">
  <div
    role="button"
    tabindex="0"
    ng-keydown="handleKeyDown($event)"
    class="ui-grid-cell-contents ui-grid-header-cell-primary-focus"
    col-index="renderIndex"
    title="TOOLTIP">
    <span
      class="ui-grid-header-cell-label"
      ui-grid-one-bind-id-grid="col.uid + '-header-text'">
      {{ col.displayName CUSTOM_FILTERS }}<b style='color: red'>*</b>
    </span>
    <span
      ui-grid-one-bind-id-grid="col.uid + '-sortdir-text'"
      ui-grid-visible="col.sort.direction"
      aria-label="{{getSortDirectionAriaLabel()}}">
      <i
       ng-class="{ 'ui-grid-icon-up-dir': col.sort.direction == asc, 'ui-grid-icon-down-dir': col.sort.direction == desc, 'ui-grid-icon-blank': !col.sort.direction }"
       title="{{isSortPriorityVisible() ? i18n.headerCell.priority + ' ' + ( col.sort.priority + 1 )  : null}}"
       aria-hidden="true">
     </i>
     <sub
       ui-grid-visible="isSortPriorityVisible()"
       class="ui-grid-sort-priority-number">
       {{col.sort.priority + 1}}
     </sub>
    </span>
  </div>

  <div
    role="button"
    tabindex="0"
    ui-grid-one-bind-id-grid="col.uid + '-menu-button'"
    class="ui-grid-column-menu-button"
    ng-if="grid.options.enableColumnMenus && !col.isRowHeader  && col.colDef.enableColumnMenu !== false"
    ng-click="toggleMenu($event)"
    ng-keydown="headerCellArrowKeyDown($event)"
    ui-grid-one-bind-aria-label="i18n.headerCell.aria.columnMenuButtonLabel"
    aria-haspopup="true">
    <i
      class="ui-grid-icon-angle-down"
      aria-hidden="true">
      &nbsp;
    </i>
  </div>

  <div ui-grid-filter></div>
</div>

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

Angular-ui-grid-如何根据单元格的值有条件地显示单元格模板

来自分类Dev

Angular-ui-grid-如何根据单元格的值有条件地显示单元格模板

来自分类Dev

Angular UI Grid,通过模板将按钮添加到行单元格

来自分类Dev

UI-GRID的默认标题单元格模板是什么?

来自分类Dev

Angular UI Grid不更新单元格中的指令

来自分类Dev

ui-grid angularjs中的条件单元格模板

来自分类Dev

Angular ui-grid无法复制单元格文本

来自分类Dev

Angular UI Grid过滤器仅适用于单元格值的开头

来自分类Dev

Angular UI Grid API在捕获最后的单元格编辑中不起作用

来自分类Dev

如何在每个标题单元格ui-grid中放置工具提示说明

来自分类Dev

ui-grid angularjs单元格模板中的自定义指令

来自分类Dev

ui-grid angularjs单元格模板中的自定义指令

来自分类Dev

Angularjs ui-grid 单元格模板中的 ng-click 不起作用

来自分类Dev

可以将标记添加到使用angular ui-grid创建的表单元格吗?

来自分类Dev

选定的ui-grid单元格的div ID

来自分类Dev

选定的ui-grid单元格的div ID

来自分类Dev

基于单元格值的UI Grid RowTemplate颜色

来自分类Dev

Kendo Grid:与Angular一起使用时,如何从组合框单元格模板中获取所选项目

来自分类Dev

Angular ng-Grid单元格文本溢出以添加单元格悬停菜单

来自分类Dev

使用Angular ui-grid时列标题换行

来自分类Dev

当范围函数尝试将单元格信息作为参数传递时,Angular JS ui-grid cellTemplate的ng-click不触发

来自分类Dev

使用angular ui-grid时如何在单击单元格时定位自定义上下文菜单?

来自分类Dev

Angular UI Grid将焦点设置为导航单元

来自分类Dev

Angular UI Grid演示错误

来自分类Dev

ui-grid排序,过滤模板单元

来自分类Dev

将显示角度ui.grid [[object HTMLDivElement]],而不是每个单元格中的数据

来自分类Dev

使用ui Grid编辑单元格功能中的后端Rest API保存更新的数据

来自分类Dev

使用可编辑的下拉单元格在ui-grid中显示可读数据

来自分类Dev

如何使用cellClass函数在UI Grid中突出显示唯一单元格?

Related 相关文章

  1. 1

    Angular-ui-grid-如何根据单元格的值有条件地显示单元格模板

  2. 2

    Angular-ui-grid-如何根据单元格的值有条件地显示单元格模板

  3. 3

    Angular UI Grid,通过模板将按钮添加到行单元格

  4. 4

    UI-GRID的默认标题单元格模板是什么?

  5. 5

    Angular UI Grid不更新单元格中的指令

  6. 6

    ui-grid angularjs中的条件单元格模板

  7. 7

    Angular ui-grid无法复制单元格文本

  8. 8

    Angular UI Grid过滤器仅适用于单元格值的开头

  9. 9

    Angular UI Grid API在捕获最后的单元格编辑中不起作用

  10. 10

    如何在每个标题单元格ui-grid中放置工具提示说明

  11. 11

    ui-grid angularjs单元格模板中的自定义指令

  12. 12

    ui-grid angularjs单元格模板中的自定义指令

  13. 13

    Angularjs ui-grid 单元格模板中的 ng-click 不起作用

  14. 14

    可以将标记添加到使用angular ui-grid创建的表单元格吗?

  15. 15

    选定的ui-grid单元格的div ID

  16. 16

    选定的ui-grid单元格的div ID

  17. 17

    基于单元格值的UI Grid RowTemplate颜色

  18. 18

    Kendo Grid:与Angular一起使用时,如何从组合框单元格模板中获取所选项目

  19. 19

    Angular ng-Grid单元格文本溢出以添加单元格悬停菜单

  20. 20

    使用Angular ui-grid时列标题换行

  21. 21

    当范围函数尝试将单元格信息作为参数传递时,Angular JS ui-grid cellTemplate的ng-click不触发

  22. 22

    使用angular ui-grid时如何在单击单元格时定位自定义上下文菜单?

  23. 23

    Angular UI Grid将焦点设置为导航单元

  24. 24

    Angular UI Grid演示错误

  25. 25

    ui-grid排序,过滤模板单元

  26. 26

    将显示角度ui.grid [[object HTMLDivElement]],而不是每个单元格中的数据

  27. 27

    使用ui Grid编辑单元格功能中的后端Rest API保存更新的数据

  28. 28

    使用可编辑的下拉单元格在ui-grid中显示可读数据

  29. 29

    如何使用cellClass函数在UI Grid中突出显示唯一单元格?

热门标签

归档