Thursday, March 3, 2016

Wrap text inside a JqGrid Cell

When showing records from a datasource, you may wonder why a certain JqGrid cell does not wrap the entire text into it's cell. An example would be a lengthy description, notes or remarks, and address. After doing some research, the fix is to add a cellattr to the grid's cell and set it's white space property to normal.

JqGrid Address Cell without cellattr property
1
{ name: 'Address', index: 'Address', width: 200, align: 'left' }



JqGrid Address Cell with cellattr property
1
2
3
{ name: 'Address', index: 'Address', width: 200, align: 'left', cellattr: 
function (rowId, tv, rawObject, cm, rdata) 
{ return 'style="white-space: normal;"' }},

0 comments:

Post a Comment