如何将类添加到由摘要功能生成的网格的一个单元格
How do I add a class to one cell of the grid generated by the Summary feature?
使用摘要功能创建网格后,我能够通过获取特征并访问与该功能关联的属性来访问列的摘要:
// inside the grid definition with two columns
// that access dataIndex 'count1' and 'count2'
listeners: {
viewready: function(grid) {
var summaryRow = grid.getView().getFeature(0).summaryRecord.data;
console.log(summaryRow.count1);
console.log(summaryRow.count2);
}
}
我想在表示summaryRow.count1
的单元格中添加一个"tot-count1"类,在表示summaryRow.count2
的单元格中添加一个"tot-count2"类。
似乎通常 ExtJS 开发人员只会大惊小怪地将类应用于网格的整行。如果我只想选择插件的行,我需要做的就是Ext.dom.Query.select('.x-grid-row-summary'
......当我想要一个 Ext.dom.Element 以利用 Ext.dom.AbstractElement 的 addCls() 方法时,它会返回一个 HTMLElement。
我正在考虑类似以下内容:
// get the Ext.dom.Element representing the cell
var cell1 = ???
// call the addCls method
cell1.addCls('tot-count1');
我曾经使用在列配置中设置的summaryRenderer
函数。
Ext.define(..., {
columns: [{
header: 'blah-blah',
dataIndex: 'foo',
summaryType: 'sum',
summaryRenderer: function (value) {
return Ext.String.format('<span class={0}>{1}</span>', 'tot-count1', value);
}
}],
features: [{
ftype: 'summary'
}]
});
相关文章:
- ExtJS网格单元格编辑器,防止焦点松动问题
- ExtJ将工具提示添加到网格单元格文本中
- 编辑后更改切片网格单元格数据
- 剑道网格单元格 :如何自动修剪文本以避免换行
- jQuery 单击事件在包含在光滑网格单元格中时不会为锚点触发
- 咏叹调网格单元格标签在 SVG 矩形内始终为空白
- Kendo UI网格单元格中的工具栏菜单,菜单是从哪个行单击的
- 使用HTML按钮更改ng网格单元格值
- Kendo UI网格-单元格上的标题属性
- 显示网格单元格中的窗口?EXTjs
- 清除activateextjs4上的可编辑网格单元格
- kendou网格单元格修剪数据值
- 剑道-在选择网格单元格时更新另一个网格(mvvm)
- 剑道网格如何以编程方式聚焦网格单元格和块选择文本
- 移除网格单元格之间的空间
- 在js/html/css中创建一个可点击的网格单元格
- ExtJs 6.0:使用组合框编辑网格单元格-不同步id值
- 当改变剑道网格单元格值并恢复到保存前的原始值时显示脏标志
- 如何为动态变化的数据更改ag网格单元格的颜色
- 禁用具有给定类的网格单元格的干净方法