EasyUI Forum
May 01, 2024, 10:34:55 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: problem with datagrid column styler in 1.3.3  (Read 16916 times)
jpierce
Jr. Member
**
Posts: 73


View Profile
« 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:


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.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 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'};
          }
        }
Logged
jpierce
Jr. Member
**
Posts: 73


View Profile
« Reply #2 on: June 27, 2013, 07:58:53 PM »

I think you're missing the point.  There's a similar problem with setting opacity.
Logged
jpierce
Jr. Member
**
Posts: 73


View Profile
« Reply #3 on: August 27, 2013, 03:06:45 PM »

Still a problem.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!