Row formatting in ag-Grid

一笑奈何 提交于 2019-12-10 23:27:46

问题


We need to conditionally make a row text as Bold. Currently its working on only single cell but we need to apply text bold on all columns cells. After applying the formatting 'isBold' column must be hide/remove. This column is used only for formatting. How to apply text-indent: 10px; of first column where the isBold column contains true value? Any possibility to achieve this?here is plunker http://plnkr.co/edit/YVGpi2FkwzCl3R1K8fwo?p=preview


回答1:


This plunker is not valid any more.

I believe that you use cellStyle callback of the columnDefs to make the font bold.

If you need to do it for the whole row, create a common callback function and use it in cellStyle of all columnDefs.

There is no single command to change the style of a row.




回答2:


This is kind of old, but for future references you can now just use getRowStyle(params). I believe in your case you would use it like:

gridOptions.getRowStyle = function (params) {
    return params.data.isBold ? {"font-weight":"bold"} : null;
}

This assumes the isBold column you mention has its values as booleans (true & false). Else you just need to change the condition.

To hide the column you just don't put its colDef with the others, and that will simply not render it but you will still have access to the data contained in it (like here above).



来源:https://stackoverflow.com/questions/33613584/row-formatting-in-ag-grid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!