2010-11-10 87 views
1

由於我們網格上的某些原因,行的垂直對齊不在中間。它似乎是頂級的。有什麼具體的事情需要做,以實現垂直對齊?jqGrid行垂直對齊不是中間

這裏的對齊的例子: 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' 
}); 

回答

1

我們在另一個div中設置了我們的網格,該網格設置了vertical-align:top。刪除了這一點,我們很好。 duh

+0

您的問題現在解決了嗎? – Oleg 2010-11-18 20:05:08

+0

是的,謝謝奧列格 – 2010-11-18 20:54:16

+7

我只是好奇。你爲什麼不把我的解決方案標記爲正確答案? – Adrian 2010-11-18 21:25:47

5

你試過應用垂直對齊:中間; CSS屬性到你的表格單元格?

我相信默認的垂直對齊是最上面的,所以應用上面的應該覆蓋它。另外,如果你可以給我一個鏈接到示例頁面的鏈接,我可以進一步研究它。

1
<style> 
    .ui-jqgrid tr.jqgrow { outline-style: none; color:#286abf;font-weight:normal; cursor : pointer; vertical-align:top } 
</style> 
+0

請爲您的答案提供一些解釋。 – 2013-01-04 13:10:59

3

這將使它中間對齊。如果您有其他需求,請將其從中間更改爲最高或最低。

<style type="text/css"> 
.ui-jqgrid tr.jqgrow td {vertical-align:middle !important} 
</style>