首页 > 代码库 > easyUI中 datagrid 格式化日期

easyUI中 datagrid 格式化日期

 $(‘#List‘).datagrid({
            url: ‘@Url.Action("GetList")‘,
            width:SetGridWidthSub(10),
            methord: ‘post‘,
            height: SetGridHeightSub(45),
            fitColumns: true,
            sortName: ‘CreateTime‘,
            sortOrder: ‘desc‘,
            idField: ‘Id‘,
            pageSize: 15,
            pageList: [15, 20, 30, 40, 50],
            pagination: true,
            striped: true, //奇偶行是否区分
            singleSelect: true,//单选模式
            //rownumbers: true,//行号
            columns: [[
                { field: ‘Id‘, title: ‘编号‘, width: 80,hidden:true },
                
                { field: ‘Tname‘, title: ‘名称‘, width: 80,sortable:true },
                { field: ‘VideoClassifyId‘, title: ‘父编号‘, width: 80, hidden: true },
                {
                    field: ‘CreateTime‘, title: ‘创建时间‘, width: 80, sortable: true,
                    formatter : function(value){
                        var date = new Date(value);
                        var y = date.getFullYear();
                        var m = date.getMonth() + 1;
                        var d = date.getDate();
                        return y + ‘-‘ +m + ‘-‘ + d;
                    }

                },
                { field: ‘VideoClassifyName‘, title: ‘上级目录‘, width: 80, hidden: true }, // by zyh
                { field: ‘Remark‘, title: ‘备注‘, width: 80,sortable:true }
                
            ]]
        });

 

easyUI中 datagrid 格式化日期