PDA

View Full Version : [4.1.1] How to set style for grid cell content



Ex_Soft
31 Oct 2012, 2:41 AM
col = new Ext.grid.column.Column({
header: "fstring",
dataIndex: "fstring",
style: {
whiteSpace: "normal"
}
});

white-space is applied to only column header.

vietits
31 Oct 2012, 4:57 AM
Try this:


col = new Ext.grid.column.Column({
header: "fstring",
dataIndex: "fstring",
style: {
whiteSpace: "normal"
},
renderer: function(value, meta){
meta.style = 'white-space: normal;'; // applied style for DIV element
meta.tdAttr = 'style="white-space: normal;"'; // applied style for TD element
return value;
}
});

sword-it
31 Oct 2012, 4:58 AM
Hi Ex_soft,

Use tdCls config to apply custom css for that grid column.
For more detail read API docs -
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.grid.column.Column-cfg-tdCls

Ex_Soft
31 Oct 2012, 5:34 AM
tdCls


.x-grid-row .multiline-content .x-grid-cell-inner {
white-space: normal;
}
...
{ header: "fstring", dataIndex: "fstring", tdCls: "multiline-content" }
...