EasyUI Forum
July 19, 2025, 07:48:04 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Styler not working on Subgrid  (Read 3610 times)
stephenl
Newbie
*
Posts: 40


View Profile
« on: January 11, 2025, 02:43:11 PM »

Hello

I have a nested Grid

The following styler works fine on the main grid, but not the sub grid

Code:
columns:[[
{field:'adjust',title:'Adjust',width:10,align:'right',
          styler: function(value,row,index){     
      if (value.charAt(0) == '-'){
                    return 'color:red;';}
}},
]],

Any suggestions why ??

Thank you
Logged
stephenl
Newbie
*
Posts: 40


View Profile
« Reply #1 on: January 19, 2025, 03:51:37 AM »

Please see below additional code in the hope this will help

Code:
var conf = {

options:{
fitColumns:true,
toolbar:'#toolbar',
columns:[[
{field:'name',title:'name',width:12},
{field:'amt1',title:'amt1',width:10,align:'right'},
{field:'amt2',title:'amt2',width:10,align:'right'},
{field:'total',title:'Total',width:10,align:'right',
styler: function(value,row,index){     
if (value.charAt(0) == '-'){
return 'color:red;';}
}},
{field:'adjust',title:'Adjust',width:10,align:'right',
styler: function(value,row,index){     
if (value.charAt(0) == '-'){
return 'color:red;';}
}},
{field:'balance',title:'Balance',width:10,align:'right',
styler: function(value,row,index){     
if (value.charAt(0) == '-'){
return 'color:red;';}
}},
]],
},

subgrid:{
options:{
fitColumns:true,
singleSelect:true,
autoUpdateDetail:false,
url:'scripts/database/get_costs.php',
foreignField:function(row){
var dp = $('#yearCombo').combobox('getValue');
                    return {
                        name:row.name,
                        year:dp
                    }},
columns:[[
{field:'date',title:'Date',width:8},
{field:'cst1',title:'Cost 1',width:7,halign:'center',align:'right',
styler: function(value,row,index){     
                if (value.charAt(0) == '-'){
      return 'color:red;';}
        }},
{field:'cst2',title:'Cost 2',width:7,halign:'center',align:'right'},
{field:'total_cst',title:'Total',width:7,halign:'center',align:'right'},
                        ]],
}
}
};
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!