我在我的项目中使用Jqgrid。在一列中,我们显示的是电子邮件地址。如果我们给出一些长的电子邮件地址,那么该列会自动重新调整长度,并将整个网格布局搞乱。由于电子邮件没有任何空间,所以它也不会扭曲。我想忽略额外的内容,并显示在给定宽度内可容纳多少内容。我已经尝试给定固定宽度。请让我知道是否有人为此提供解决方案。在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
},
});
感谢 桑迪
张贴您的代码,然后只有一个可以帮助 – Kris