由于某种原因,在我们的网格上,行的垂直对齐不是中间的。它似乎是顶级的。您是否需要具体确定垂直对齐方式?
以下是对齐的示例:
我们的网格定义:
$.extend(jQuery.jgrid.defaults, {
url:'NoData.json',
datatype: 'json',
mtype: 'GET',
altRows:true,
//altclass:'zebraOdd',
loadError: function(xhr,st,err) {
handleError(xhr, 'Error loading grid');
},
onPaging: function (b) {
return onPage($(this));
},
beforeRequest: function() {
beforeReq($(this));
},
loadComplete: function() {
loadComp($(this));
},
onSelectRow: function(id){
$(this).resetSelection(); //This prevents the disabling of the row hovering and altclass - http://stackoverflow.com/questions/3916477
},
scrollOffset:0, //No scrollbar
rowNum:15,
shrinkToFit:true,
width:1120,
viewrecords: true ,
height: '360',
hidegrid: false //Don't show the expand/collapse button on the top right
});
$("#grid-pos").jqGrid({
colNames:['Position Account', 'Product Code', 'Product Type','Expiry', 'Put/Call', 'Strike Price', 'Current Long', 'Current Short', 'Held Exercise Requests', 'Held Abandon Requests', 'Last Trade Date / Expiration Date', 'Select Operation'],
colModel :[
{name:'account', index:'account', width:85, sortable:false},
{name:'productCode', index:'productCode', width:85, sortable:false},
{name:'productType', index:'productType', width:85, sortable:false},
{name:'expiry', index:'expiry', width:85, align:'right',stype:'select', sortable:false},
{name:'putCall', index:'putCall', width:85, sortable:false},
{name:'strike', index:'strike', sorttype: 'float', align:'right', width:85, sortable:false},
{name:'long', index:'long', width:85, align:'right', sortable:false},
{name:'short', index:'short', width:85, align:'right', sortable:false},
{name:'exercise', index:'exercise', width:90, align:'right', sortable:false},
{name:'abandon', index:'abandon', width:90, align:'right', sortable:false},
{name:'LTD', index:'LTD', width:110, align:'right', sortable:false},
{index:'operations', width:150, title:false, align: 'center', formatter:opsFormatter, sortable:false}
],
pager: '#div-pos-pager',
caption: 'View Positions'
});
答案 0 :(得分:5)
您是否尝试过应用vertical-align:middle;你的表格单元的css属性?
我相信默认垂直对齐是顶部所以应用上面应该覆盖它。此外,如果您可以给我一个显示此示例页面的链接,我可以进一步调查。
答案 1 :(得分:3)
这将使它成为中间对齐。如果您有其他需求,请将其从中间更改为顶部或底部。
<style type="text/css">
.ui-jqgrid tr.jqgrow td {vertical-align:middle !important}
</style>
答案 2 :(得分:1)
我们的网格位于另一个设置了vertical-align:top
的div中。删除了这个,我们很好。咄
答案 3 :(得分:1)
<style>
.ui-jqgrid tr.jqgrow { outline-style: none; color:#286abf;font-weight:normal; cursor : pointer; vertical-align:top }
</style>