EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: crosemffet on November 26, 2015, 04:13:28 PM



Title: datagrid image on cell
Post by: crosemffet on November 26, 2015, 04:13:28 PM
hello and thanks in advance for your support,
I have one datagrid, with url loading method.
the columg gets its data from the server:
<th data-options="field:'myDataBaseField',width:20,styler:cellStyler">xxx</th>
everything works ok. I have also the cellStyler function to change background color of the cell if value meets specific requirements:function cellStyler(value,row,index){
   if (value == 0){
      return 'background-color:#ffee00;color:red;';
   }
}
the problem is I want to put one image on the cell, not change the background color.
any idea will be very appreciated, I'm stuck on it,


Title: Re: datagrid image on cell
Post by: stworthy on November 26, 2015, 11:32:33 PM
Please try to use the 'formatter' function instead.
Code:
formatter: function(value, row){
  if (value == 0){
    return '<img src.../';
  }
}