EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: aswzen on October 28, 2014, 05:31:11 AM



Title: How to set individual row height based on a criteria in datagrid?
Post by: aswzen on October 28, 2014, 05:31:11 AM
Hello again...

How to set individual row height based on a criteria?

here are my best..but this affect to all row..
:(
Code:
<style>
.datagrid-header-row, .datagrid-row{
height:30px;
}
</style>

for example..i want some row height is about 100px when the value of QTY is more than 30...
how to do that?


thanks in advance  


Title: Re: How to set individual row height based on a criteria in datagrid?
Post by: jarry on October 28, 2014, 08:12:25 AM
The possible way to set a row height is to define a 'formatter' function for the specified column.
Code:
$('#dg').datagrid({
columns:[[
{field:'itemid',title:'Item Id',width:100,
formatter:function(value){
    if (value == 'EST-12'){
        return '<div style="height:100px;line-height:100px">'+value+'</div>';
    } else {
        return value;
    }
}
}
]]
})

Another way to solve this issue is to get the tr element and set the height for it.
Code:
var dg = $('#dg');
var tr = dg.datagrid('options').finder.getTr(dg[0], index);
tr.css('height','100px')


Title: Re: How to set individual row height based on a criteria in datagrid?
Post by: aswzen on October 28, 2014, 07:44:37 PM
wow thank you :)