Copy codeThe 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.doc umentElement. clientWidth * 0.18)/11.5)
Return rec.activitycontent.substring(0, math.ceil(document.doc umentElement. clientWidth * 0.18/11.5) + '..';
Else
Return rec.activitycontent.substring(0, math.ceil(document.doc umentElement. clientWidth * 0.18/11.5 ));
}
}
},
{..}
]
Note that the activitycontent and 0.18 must have the same parameter ratio of 11.5. You can test and adjust the ratio by yourself. Here, we use this parameter to integer Chinese characters.
If the text content is greater than the length, the result is
Test length 8 test length 74 test ..
Otherwise
Test length 8 test length 74 Test