jquery - jqGrid行垂直对齐不居中

标签 jquery jqgrid alignment

由于某种原因,在我们的网格上,行的垂直对齐方式不是居中。看来是顶级了。为了实现垂直对齐,您需要做一些具体的事情吗?

下面是对齐的示例: alt text

我们的网格定义:

$.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/

相关文章:

javascript - 如何在 Javascript onload 中捕获表单提交?

jquery - jqGrid:当 cellattr 返回包​​含 "style"的字符串时出现困惑

html - 各种div的对齐

javascript - 用于显示服务器端验证结果的 Jqgrid 编辑事件

jquery - jqgrid 的 delGridRow 不工作

python - 如何在 Tkinter 中调整标签中的文本

html - 水平对齐表格的CSS方法

javascript - 是否可以轻松地将 jquery/javascript 鼠标悬停延迟添加到仅 css 下拉菜单?

javascript - 使用 jquery 查找并聚焦第一个元素

javascript - 使用 javascript 取消表单提交不起作用