1

我已阅读有关此的所有主题,并且似乎我正确构建了它。但是 setColProp 仍然没有效果。我在这里缺少什么?请帮忙。我正在使用 jqGrid 4.4

        var grid = $("#l-drill-emp-grid")
    var pager_id = 'l-drill-emp-pager';

        grid.jqGrid({
        data : drillgrid.rows,
        datatype: "local",
        colNames: ['date', 'day', 'time_In', 'time_Out', 'late','underTime', 'overTime', 'unpaidLV', 'timeOff' ],
        colModel: [
            {name:'date',index:'date', width:120, sorttype:'date'},
            {name:'day',index:'day', width:70, align:"center", sorttype:'text'},
            {name:'time_in',index:'time_in', width:80, align:"center"},
            {name:'time_out',index:'time_out', width:80, align:"center"},
            {name:'late',index:'late', width:80, align:"center"},
            {name:'ut',index:'ut', width:80, align:"center"},
            {name:'ot',index:'ot', width:80, align:"center"},
            {name:'ulv',index:'ulv', width:80, align:"center"},
            {name:'timeoff',index:'timeoff', width:80, align:"center"},
        ],
        rowNum:15,
        rowList:[10,15,20,30],
        viewrecords: true,
        loadonce: true,
        pager: pager_id,
        sortname: 'date',
        sortorder: "desc",
        height: '100%',
        altRows: true,
        altclass: 'oddRow',
        gridComplete: function() {
        grid.find(".jqgrow:odd").hover(
            function() { $(this).removeClass("oddRow");}, 
            function(event) { $(this).addClass("oddRow");}
        );
    },
    loadComplete: function(data) {
                grid.jqGrid('setColProp', 'date', {
                    align: "center"
                });
            },

    });
4

1 回答 1

3

您是否尝试更改其他colModal选项?我的意思是,除了对齐之外还有什么?因为根据文档,有些属性可能不会改变。

这个

于 2012-07-24T11:47:48.770 回答