这个问题在这里被问到了. jqGrid列未与列标题对齐
但是边框右边的颜色似乎对我不起作用.
我正在使用jqGrid 3.8和IE 8
这是我对jqGrid的设置
shrinkToFit:true,
colModel :[
{name:'leid', index:'leid', width:70, label:'LEID'},
{name:'cdr', index:'cdr', width:40, label:'CDR'},
{name:'name', index:'name', width:160, label:'Name'},
{name:'country', index:'country', width:98, label:'Country'},
{name:'fc', index:'fc', width:50, label:'FC'},
{name:'bslaMe', index:'bslaMe', width:65, label:'BSLA/ME'},
{name:'business', index:'business', width:130, label:'Business'},
{name:'amtFc', index:'amtFc', width:98, label:'Amt(FC)', align:'right',
formatter:'currency', formatoptions:{decimalSeparator:".",
thousandsSeparator: ",", decimalPlaces: 2, prefix: "", suffix:"",
defaultValue: '0'} },
{name:'amtUsd', index:'amtUsd', width:98, label:'Amt(Cur)', align:'right',
formatter:'currency', formatoptions:{decimalSeparator:".",
thousandsSeparator: ",", decimalPlaces: 2, prefix: "", suffix:"",
defaultValue: '0'} },
{name:'cashPoolHeader', index:'cashPoolHeader', width:120,
label:'Cash Pool Header'},
{name:'cashPoolCDR', index:'cashPoolCDR', width:60, label:'CP CDR'},
{name:'cashPoolName', index:'cashPoolName', width:160, label:'Cash Pool Name'}
],
Run Code Online (Sandbox Code Playgroud)
有什么想法吗?
小智 6
我遇到了同样的问题,我通过附加4行代码来解决这个问题gridComplete,这4行将改变td内容区域td的样式[第一行的样式修改就足够了].
这是jqgid中的一个问题,它实际上是设置td内部的,<thead>但这种风格并没有反映在td内容区域中.在开发jqgrid时,他们假设整个列的宽度将通过改变一行的宽度来实现,td但它们只是改变了,<thead>这是持久性问题.
设置列宽colModel:
colModel: [
{
name: 'Email',
index: 'Email',
editable: true,
edittype: 'custom',
width: 220,
editoptions: {
custom_element: function(value, options) {
return EmailAddressCustomElement(value, options);
},
custom_value: function(elem) {
var inputs = $("input", $(elem)[0]);
return inputs[0].value;
}
}
},
{
name: 'LocationAndRole',
index: 'LocationAndRole',
editable: true,
align: "left",
edittype: "button",
width: 170,
editoptions: {
value: 'Edit Location And Role',
dataEvents: [{
type: 'click',
fn: function(e) {
ShowUsersLocationAndRoles(e);
}
}]
}
}
]
Run Code Online (Sandbox Code Playgroud)
在gridComplete事件中添加以下代码:
gridComplete: function() {
var objRows = $("#list_accounts tr");
var objHeader = $("#list_accounts .jqgfirstrow td");
if (objRows.length > 1) {
var objFirstRowColumns = $(objRows[1]).children("td");
for (i = 0; i < objFirstRowColumns.length; i++) {
$(objFirstRowColumns[i]).css("width", $(objHeader[i]).css("width"));
}
}
}
Run Code Online (Sandbox Code Playgroud)
我希望上面的代码可以帮助您解决问题.
| 归档时间: |
|
| 查看次数: |
19485 次 |
| 最近记录: |