search

Home  >  Q&A  >  body text

angular.js - 如何改变UI grid 中data的颜色

如图所示,我需要把同一个格子里面的数据用不同颜色表示出来。数据是以list的形式从rest API中获取的,即[19,17,15]。

主要是想表示变化,例如增加的标注蓝色,被删掉的改成红色。我在UI grid中没有找到这个功能,想请问大家,有没有好的建议来实现。

使用其他的库或者其他的方法也可以,不一定非要用UI grid。

非常感谢!

ringa_leeringa_lee2744 days ago600

reply all(1)I'll reply

  • 怪我咯

    怪我咯2017-05-15 16:54:30

    %>_<%, the most lonely moment is when you ask and answer your own questions.

    In the end, I used cellTemplate, nested several p's in each td, and then used repeat to generate p. The size of p was set to the same, and the height of the grid cell was the same, and then each p was arranged side by side, with the color of the words Determined by p's css. By the way, we must first turn the string object into a slice into an array.

    ng-class="{greenbar: !item.flag, whitebar: item.flag,}"
    ng-repeat="item in row.entity.no_change"

    This is the general idea. Who can give me some better suggestions? ! !

    reply
    0
  • Cancelreply