admin管理员组文章数量:1296914
Essentially what I want to do is to apply additional CSS classes to individual cells in a data grid based on the value of the cell. An example would be to color the text red when a dollar value is negative.
The only solution I've found was to use the formatter of the column to create a string for a span that has the class based on the value passed in. I figure there has to be a better way.
Essentially what I want to do is to apply additional CSS classes to individual cells in a data grid based on the value of the cell. An example would be to color the text red when a dollar value is negative.
The only solution I've found was to use the formatter of the column to create a string for a span that has the class based on the value passed in. I figure there has to be a better way.
Share Improve this question asked Mar 31, 2010 at 14:24 larf311larf311 1,8353 gold badges20 silver badges24 bronze badges1 Answer
Reset to default 9When specifying the structure, you pass in an object that represents the widget configuration for a given column. As part of this object, include a formatter function in the definition:
{
...
formatter: function(val, rowIdx, cell) {
classes = pute_classes(val, rowIdx, cell);
cell.customClasses.push(classes);
}
}
however your 'pute_classes' putes the classes to use is up to you. They will be applied to the cell, and then you can manage their appearance in your CSS.
本文标签: javascriptHow do you conditionally style a cell in a Dojo data gridStack Overflow
版权声明:本文标题:javascript - How do you conditionally style a cell in a Dojo data grid? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741620281a2388769.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论