setColProp无法正常工作jqGrid

时间:2012-07-22 02:45:51

标签: jqgrid

我已经阅读了有关这方面的所有主题,看来我正确地构建了它。但仍然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"
                });
            },

    });

1 个答案:

答案 0 :(得分:3)

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

阅读this