使用NG-格,我想补充我自己的提示,使用标题单元格模板。要做到这一点,我想创建一个名为提示,例如列属性。试过了,它不会在山坳的属性显示。你觉得给我们的功能是什么。否则,我创建在每种情况下一个新的模板?
请参阅plunkr: http://plnkr.co/edit/lSf4XK?p= preVIEW
理想情况下,gridOptions将包含这样的columnDefs:
columnDefs: {场:'complex.name,显示名:名称,headerCellTemplate:header_template2.html}, {场:'complex.active', DIMENSION1:测试, 显示名:进行中, headerCellTemplate:header_template.html', cellTemplate:'checkBoxTemplate.html'}]
和 DIMENSION1
属性将在像这样的模板访问:
< DIV提示={{col.dimension1}}> {{col.displayName}}< / DIV>
解决方案
内置的解决方案 - 多一种解决方法 - 在这里: http://plnkr.co/edit/0PMmrw?p=$p$pview
下面是摘录。我让显示名
的对象,而不是一个字符串:
columnDefs: {场:'complex.name,显示名:名称}, {场:'complex.active', cellClass:溢出可见, 显示名:{名称:进行中,提示:测试}, headerCellTemplate:header_template.html', cellTemplate:'checkBoxTemplate.html'}]
,然后参考它在细胞中的模板,像这样:
< DIV NG点击=col.sort($事件)NG-CLASS ='小马'+ col.index级=ngHeaderText工具提示={ {col.displayName.tooltip}}> {{col.displayName.name}}< / DIV>
修改这里的问题是,由于NG-电网的实现需要显示名是一个字符串(至少在V2.0.7),它会抛出错误;它调用col.displayName.toLowerCase()。
Using ng-grid, I'd like to add my own tooltip, using a header cell template. To do so I'd like to create a column property called "tooltip" for instance. Tried that and it doesn't show up in the col properties. What do you think about giving us that functionality. Otherwise I create a new template in each case?
See plunkr: http://plnkr.co/edit/lSf4XK?p=preview
Ideally, the gridOptions would contain columnDefs like this:
columnDefs: [
{field: 'complex.name', displayName: 'Name', headerCellTemplate:'header_template2.html'},
{field:'complex.active',
dimension1: "Testing",
displayName: 'In Progress',
headerCellTemplate:'header_template.html',
cellTemplate : 'checkBoxTemplate.html'}]
and that dimension1
property would be accessible in the template like so:
<div tooltip="{{col.dimension1}}">{{col.displayName}}</div>
解决方案
Built a solution - more of a workaround - here: http://plnkr.co/edit/0PMmrw?p=preview
Here's an excerpt. I make displayName
an object instead of a string:
columnDefs: [
{field: 'complex.name', displayName: 'Name'},
{field:'complex.active',
cellClass: 'overflow-visible',
displayName: {name:'In Progress', tooltip:'Testing'},
headerCellTemplate:'header_template.html',
cellTemplate : 'checkBoxTemplate.html'}]
And then refer to it in the cell template like so:
<div ng-click="col.sort($event)" ng-class="'colt' + col.index" class="ngHeaderText" tooltip="{{col.displayName.tooltip}}">{{col.displayName.name}}</div>
Edit The problem with this is that it will throw errors because the implementation of ng-grid expects displayName to be a string (at least in v2.0.7); it calls col.displayName.toLowerCase().