EasyUI Forum
May 09, 2024, 12:08:38 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: How to set individual row height based on a criteria in datagrid?  (Read 6354 times)
aswzen
Sr. Member
****
Posts: 287


Indonesian

aswzen
View Profile WWW Email
« 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..
Sad
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  
« Last Edit: October 28, 2014, 05:34:41 AM by Agus Sigit Wisnubroto » Logged

Regards,
Sigit

- Indonesian jEasyUI Facebook page : https://www.facebook.com/groups/jeasyuiid/
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 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')
Logged
aswzen
Sr. Member
****
Posts: 287


Indonesian

aswzen
View Profile WWW Email
« Reply #2 on: October 28, 2014, 07:44:37 PM »

wow thank you Smiley
Logged

Regards,
Sigit

- Indonesian jEasyUI Facebook page : https://www.facebook.com/groups/jeasyuiid/
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!