Sample code in JQuery where the dataGrid sets the height of the row
- 2020-03-30 01:13:27
- OfStack
columns:[[
{field:"activitycontent",title:' Active 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));
}
}
},
{..}
]]
Notice some of the same places, activitycontent and 0.18 should be the same parameter ratio 11.5, you can test and adjust by yourself, here I used to take the whole of Chinese characters
If the text is bigger than that, it's going to be zero
Test length 8 test length 74 test..
Otherwise it is
Test length 8 test length 74 test