我正在测试企业版,我想知道我是否可以在状态栏中显示一些自定义文本? (如果状态栏不可用,还有替代方案吗?)
要么
指标:蓝色 – 人工存款,红色 – 存款失败,绿色 – 成功
(在此示例中使用自定义样式显示颜色)
这可能吗?
(顺便说一下,我正在使用Angular 1)
解决方法
你问过两个不同的问题,我会试着解释两个问题.
I want to show X rows / Y total rows of the table
您在gridOptions.api.getModel().getRowCount()中有Y行总数.我假设的X行是指’当前显示的行’,我认为目前还没有获得它的方法.我们过去常常,所以我可能错了.
Indicators: Blue – Manual Deposit,Red – Failed Deposit,Green – Success
我想你在谈论改变单元格/行样式?对于单元格样式,请查看Column Definition cellClassRules.从网页:
ag-Grid allows rules to be applied to include certain classes. If you use AngularJS,then this is similar to ng-class,where you specify classes as Javascript object keys,and rules as object values.
您可以像这样使用它:
//'Success','Manual' and 'Failed' are placeholders for the actual values // you must compare to. cellClassRules: { 'green': function(params) { return params.value === 'Success'},'blue': function(params) { return params.value === 'Manual'},'red': function(params) { return params.value === 'Failed'} },
对于整行样式,您可以使用what I explained in this other question实现它
// Again,'Success','Manual' and 'Failed' are placeholders // for the actual values you must compare to. gridOptions.api.getRowStyle(params) { switch(params.data.myColumntocheck){ case 'Success': return {'background-color': 'green'}; case 'Manual': return {'background-color': 'blue'}; case 'Fail': return {'background-color': 'red'}; } return null; }