Home  >  Article  >  Web Front-end  >  Sample code for setting row height in dataGrid in JQuery_jquery

Sample code for setting row height in dataGrid in JQuery_jquery

WBOY
WBOYOriginal
2016-05-16 17:05:261442browse
Copy code The code is as follows:

columns:[[
{field:"activitycontent",title :'Activity content',width:fixWidth(0.18),align:"center",halign:"center",
formatter:function(value,rec){
if(value.indexOf("src") <0){
if(rec.activitycontent.length>Math.ceil(document.documentElement.clientWidth * 0.18)/11.5)
return rec.activitycontent.substring(0,Math.ceil(document.documentElement .clientWidth * 0.18/11.5)) '..';
else
return rec.activitycontent.substring(0,Math.ceil(document.documentElement.clientWidth * 0.18/11.5));
}
}
},
{..}
]]

Note that there are several similarities among them. Activitycontent and 0.18 have the same parameter ratio of 11.5. You can test and adjust it yourself. , I use it here to round Chinese characters
If the text content is greater than that length, the result is
Test length 8 Test length 74 test..
Otherwise it is
Test length 8 Test length 74 test
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn