我在我的项目中使用Jqgrid。在一栏中,我们显示了电子邮件地址。如果我们给出一些长的电子邮件地址,那么该列会自动重新调整大小,从而搞乱整个网格布局。由于电子邮件没有任何空格,所以它也不会翘曲。我想忽略额外的内容,并显示给定宽度可以容纳多少。我已经尝试给出固定宽度。如果有人有解决方案,请告诉我。
代码:
jQuery('#userDetail').jqGrid({
url: endpoint,
datatype: 'json',
height: 50,
colNames:['Names','Email', 'Phone Number', 'Fax Number', 'Country'],
colModel:[
{
name:'names',
index:'names',
sortable: false,
width:200,
resizable: false
}, {
name:'email',
index:'email',
sortable: false,
width:200,
resizable: false
}, {
name:'phone',
index:'phone',
sortable: false,
resizable: false,
width:200
}, {
name:'fax',
index:'fax' ,
sortable: false,
resizable: false,
width:200
}, {
name:'country',
index:'country',
sortable: false,
resizable: false,
width:200,
}
],
multiselect: false,
autowidth: true,
caption: 'User Details',
loadComplete: function(response) {
if(!util.errorHandler(response)){
}
},
jsonReader : {
root: "rows",
page: "page",
total: "total",
records: "records",
id: "_id",
repeatitems: false
},
});
由于 沙
答案 0 :(得分:2)
我不确定我是否理解您的要求。你写的主要是关于没有像电子邮件这样的空格的长文本的翘曲问题。这个问题可以通过使用字符包装来解决。有关详细信息,请参阅the answer。 Another answer提供了有关在不同Web浏览器中实现字符级别包装的其他信息。如果文本包含空格,则大多数Web浏览器都会进行单词级别换行,并且只有在文本中不存在空格时才进行字符换行。这不是你需要的吗?