带有 MVC cellFilter 的 NgGrid 不起作用

NgGrid with MVC cellFilter doesn't work

我正在使用 MVC 和 AngularJs。问题是我的模型 (class) 具有 DateTime 类型的 属性。当我从数据库中获取 JSON 时,它将数据转换为

/Date(1432617857710)/
此处发布的

"Solution" 应该有帮助,但没有帮助。我做错了什么?

这是我的网格选项:

$scope.gridOptions = {
        data: 'testData',
        enableRowSelection: false,
        columnDefs: [
            { width: 50, cellTemplate: '<div ng-show=checkForNullId(row.entity.Id) class="icon_animated" style="height:50px;"><span class="glyphicon glyphicon-floppy-save"></span></div>' },
            { field: 'Id', visible: false },
            { field: 'Name', displayName: 'Name' },
            { field: 'Age', displayName: 'Age' },
            { field: 'Date', displayName: 'Register Date', cellFilter: 'date:"yyyy-MM-dd"' },
            { width: 50, cellTemplate: '<button ng-hide=checkForNullId(row.entity.Id) id="editBtn" type="button" title="Redaguoti" class="btn btn-primary btn-small" ng-click="edit(row.entity)" ><span class="glyphicon glyphicon-edit"></span></button> ' },
            { width: 50, cellTemplate: '<button ng-hide=checkForNullId(row.entity.Id) id="deleteBtn" type="button" title="Trinti" class="btn btn-danger btn-small" ng-click="remove(row.entity)" ><span class="glyphicon glyphicon-remove"></span></button> ' }
        ]
    };

根据示例添加转义字符 \

换行,

{ field: 'Date', displayName: 'Register Date', cellFilter: 'date:"yyyy-MM-dd"' },

{ field: 'Date', displayName: 'Register Date', cellFilter: 'date:\'yyyy-MM-dd\'' },

更新

从数据库中获取数据时,将 Date 转换为 moment,如下所示。

testData.Date = moment(testData.Date).format("yyyy-MM-dd");