由于某种原因,在我们的网格上,行的垂直对齐方式不是居中。看来是顶级了。为了实现垂直对齐,您需要做一些具体的事情吗?
下面是对齐的示例:
我们的网格定义:
$.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'
});
最佳答案
您是否尝试过应用vertical-align: middle; css 属性到你的表格单元格?
我相信默认的垂直对齐方式是顶部,因此应用上面的内容应该覆盖它。另外,如果您能给我一个显示此内容的示例页面的链接,我可以进一步研究它。
关于jquery - jqGrid行垂直对齐不居中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4148469/