angularjs - How to change data color in UI Grid Angular -
|number | 1 3 4|
for example , need show "1" red , "3" green . in same cell . know can use cell class change whole data color in 1 cell . 's not want .
could please give me clues work out ? or other way ,like angular ui or using other libraries .
thanks
i suspect isn't ui-grid thing, being general question of how render data in angular colours.
i custom celltemplate, , sort of ng-style. question how data arriving in cell - 1 3 4
coming cell value, or have else going on?
assuming in cell value, you'd need like
<div ng-style="grid.appscope.setstyle(grid.appscope.left(col_field)>grid.appscope.left(col_field)</div> <div ng-style="grid.appscope.setstyle(grid.appscope.mid(col_field)>grid.appscope.mid(col_field)</div> <div ng-style="grid.appscope.setstyle(grid.appscope.right(col_field)>grid.appscope.right(col_field)</div>
where - setstyle
function on scope takes in number , decides style apply - left
gets leftmost number data - mid
gets middle number data - right
gets rightmost number data
if input structures different there other ways use celltemplates result want.
edit: based on further information, think you'll want render string html, , parse html cell. think more broader question of "how can angularjs render arbitrary html me", , answer may ng-bind-html, although don't know it. in theory let create markup in html, bind resulting markup cell using ng-bind-html='col_field'
in celltemplate.
Comments
Post a Comment