EasyUI Forum

General Category => General Discussion => Topic started by: jpierce on June 27, 2013, 08:29:26 AM



Title: problem with datagrid column styler in 1.3.3
Post by: jpierce on June 27, 2013, 08:29:26 AM
I've noticed a bit of a shortcoming in the way the column styler is handled in 1.3.3.  It's built such that the return value of the styler is assigned both to the TD and the nested DIV.  This is usually okay, but there are situations it's not desirable in, namely when the properties are additive.

For example, if you go to the DataGrid Cell Style demo and issue the following:

Code:
$('.easyui-datagrid').datagrid({
  columns:[[
    {
        field:'listprice',title:'List Price', width:80, align:'right',
        styler:function (value, row, index) {
          if (value > 30) {
            return 'border:1px solid black';
          }
        }
    }
  ]]
})

You get doubled borders:
(http://i.imgur.com/sjYygR2.png)

Another example is opacity.  Any opacity set is going to be squared (so an opacity of 0.25 will become 0.25x0.25=0.0625).

I can get around this by using styles or by implementing the custom styler stuff you showed me in the other thread, but I thought you should know about this side-effect of the new implementation.


Title: Re: problem with datagrid column styler in 1.3.3
Post by: stworthy on June 27, 2013, 06:37:03 PM
The datagrid cell has its border definition. Do not set the border style again, if you really want, try to set the 'border-color' style.
Code:
styler:function (value, row, index) {
          if (value > 30) {
            return 'border-color:black';
          }
        }

Or return the css class as discussed in http://www.jeasyui.com/forum/index.php?topic=1827.0
Code:
<style>
.datagrid-body .cc{
  border-color:#000;
}
</style>
styler:function (value, row, index) {
          if (value > 30) {
            return {class:'cc'};
          }
        }


Title: Re: problem with datagrid column styler in 1.3.3
Post by: jpierce on June 27, 2013, 07:58:53 PM
I think you're missing the point.  There's a similar problem with setting opacity.


Title: Re: problem with datagrid column styler in 1.3.3
Post by: jpierce on August 27, 2013, 03:06:45 PM
Still a problem.