zoukankan      html  css  js  c++  java
  • 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 "";
            }
    要显示的时间格式类型可以在这个里面修改
  • 相关阅读:
    将C#文档注释生成.chm帮助文档
    Html5shiv
    C#创建COM组件
    WebBrowser控件使用详解
    iframe跨域
    VMware Workstation 虚拟机暂停后无法启动 出现Exception 0xc0000006 (disk error while paging) has occurred.错误
    Java Timer 定时器的使用
    adf笔记
    JS编码解码
    【Python】Django CSRF问题
  • 原文地址:https://www.cnblogs.com/GuyCui/p/9831154.html
Copyright © 2011-2022 走看看