JS表格顯示時間格式


<!-- JS代碼區 -->
    <script type='text/javascript'>
    $(function() {
        var grid_selector23 = "#bsp-demo-grid-table_lib";
        var pager_selector23 = "#bsp-demo-grid-pager_lib";
        //寬度自適應
        $(window).on('resize', function() {
            $(grid_selector23).jqGrid('setGridWidth', $(".page").width());
        });
        demo_monitor_grid23 = jQuery(grid_selector23).jqGrid({
            url : "${root!}/cloud/fixedInvestmentSplit/libSelected",
            datatype : "json",
            mtype : "POST",
            height : '100%',
            colNames : [ 
                         '項目名稱', '項目類型','項目隸屬關系','建設地點', '國標行業','所屬行業', '總投資(萬元)', "擬開工年份","擬建成年份",
                         "項目雲序號","是否跨區域"
                       ],
            colModel : [            
            {name : 'PROJECT_NM',index : 'PROJECT_NM',sortable : false,align : 'center',width : '15%',editable : false}, 
            {name : 'PROJECT_CATEGORY',index : 'PROJECT_CATEGORY',sortable : false,align:'center',width : '7%',editable : false}, 
            {name : 'PROJECT_LEVEL',index: 'PROJECT_LEVEL',sortable : false,align : 'center',width : '10%',editable : false,formatter:levelFormatOperation},
            {name : 'CONS_PLACE',index : 'CONS_PLACE',sortable : false,align : 'center',width : '10%',editable : false}, 
            {name : 'CN_INDUSTRY',index : 'CN_INDUSTRY',sortable : false,align : 'center',width : '10%',editable : false}, 
            {name : 'PROJECT_INDUSTRY',index : 'PROJECT_INDUSTRY',sortable : false,align : 'center',width : '10%',editable : false}, 
            {name : 'TOTAL_INV',index : 'TOTAL_INV',sortable : false,align : 'right',width : '8%',editable : false}, 
            {name : 'PLAN_START_DATE',index : 'PLAN_START_DATE',sortable : false,align : 'center',width : '10%',formatter : formatDate,editable : false}, 
            {name : 'PLAN_FINISH_DATE',index : 'PLAN_FINISH_DATE',sortable : false,align : 'center',width : '10%',formatter : formatDate,editable : false}, 
            
            {name : 'PROJECT_NO',index : 'PROJECT_NO',sortable : false,align : 'left',width : '0%',editable : false,hidden:true},
            {name : 'IS_WR_PROJECT',index : 'IS_WR_PROJECT',sortable : false,align : 'left',width : '0%',editable : false,hidden:true}],
            viewrecords : true,
            rowNum : 10,
            rowList : [ 10, 20, 30 ],
            pager : pager_selector23,
            altRows : true,
            forceFit : true,
            sortable : true,
            sortname : 'name',
            sortorder : 'ASC',
            multiselect : true,
            loadComplete : function() {

            },
            autoheight : true,
            autowidth : true
        });
        
        function formatDate(cellvalue, options, cell) {
            if (cellvalue != null && cellvalue != "" && cellvalue != "undefined") {
                var date = new Date(cellvalue);
                return date.format("yyyy-MM-dd");
            }
            return "";
        }
        
        //設置內嵌滾動條
        demo_monitor_grid23.closest(".ui-jqgrid-bdiv").css({"max-height":"300px","overflow-y":"auto"});    
        
    });
function formatDate(cellvalue, options, cell) {
            if (cellvalue != null && cellvalue != "" && cellvalue != "undefined") { var date = new Date(cellvalue); return date.format("yyyy-MM-dd"); } return ""; }
要顯示的時間格式類型可以在這個里面修改


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM