Syncfusion 网格在过滤时不加载日期
Syncfusion Grid Not Loading Dates When Filtering
使用 syncfusion 网格呈现 table 数据。过滤“Line Approved Date”时,mini window 无限期保持加载状态。
过滤功能适用于其他列。
关于如何使日期出现在过滤器中的任何想法 window?
这里是上下文的一些代码:
//note - order of grouping header columns is hard coded
function GetColumns() {
var output = [
{
field: "LineApprovedDate",
headerText: "Line Approved Date",
type: "date",
format: { type: 'date', format: 'MM/dd/yyyy' },
clipMode: 'EllipsisWithTooltip',
width: 70
}
];
return output;
}
window.groupingHeader = function (args) {
'<table class="e-table history-grid-group-headers" style="background: #fafafa;">' + '<tbody>' +
'<td class="e-rowcell group-headercell" role="gridcell" aria-colindex="12">'
+ (item.LineApprovedDate === null ? "" : moment(item.LineApprovedDate).format("MM/DD/YYYY"))+ '</td>' +
'</tr >' + '</tbody></table>';
return groupHeader;
}
//grid configurations
window.SetupGrid = function () {
SetUpGroupingHeaderData();
var opts = {
dataSource: coData,
allowSorting: true,
allowFiltering: true,
filterSettings: { type: 'Excel' },
allowGrouping: true,
groupSettings: {
captionTemplate: '#groupingheader-template',
showDropArea: false,
columns: ["PoLineNumber"]
},
enableHover: false,
allowSelection: false,
height: GetHistoryGridHeight(),
width: '100%',
columns: GetColumns(),
showColumnMenu: true,
columnMenuItems: ['SortAscending', 'SortDescending', 'AutoFit', 'AutoFitAll', 'Filter'],
enableVirtualization: true,
allowResizing: true,
resizeStop: function (args) {
var index = args.column.index;
$('.history-grid-group-headers td:nth-of-type(' + index + ')').outerWidth(args.column.width);
},
clipMode: "EllipsisWithTooltip",
gridLines: "Both",
}
检查来自 API 调用的数据表明正在接收与日期相关的数据作为字符串。添加以下函数将日期相关数据转换为日期类型。
data.forEach(function (d) {
if (d.LineApprovedDate != null) {
d.LineApprovedDate = new Date(d.LineApprovedDate);
}
})
使用 syncfusion 网格呈现 table 数据。过滤“Line Approved Date”时,mini window 无限期保持加载状态。
过滤功能适用于其他列。 关于如何使日期出现在过滤器中的任何想法 window?
这里是上下文的一些代码:
//note - order of grouping header columns is hard coded
function GetColumns() {
var output = [
{
field: "LineApprovedDate",
headerText: "Line Approved Date",
type: "date",
format: { type: 'date', format: 'MM/dd/yyyy' },
clipMode: 'EllipsisWithTooltip',
width: 70
}
];
return output;
}
window.groupingHeader = function (args) {
'<table class="e-table history-grid-group-headers" style="background: #fafafa;">' + '<tbody>' +
'<td class="e-rowcell group-headercell" role="gridcell" aria-colindex="12">'
+ (item.LineApprovedDate === null ? "" : moment(item.LineApprovedDate).format("MM/DD/YYYY"))+ '</td>' +
'</tr >' + '</tbody></table>';
return groupHeader;
}
//grid configurations
window.SetupGrid = function () {
SetUpGroupingHeaderData();
var opts = {
dataSource: coData,
allowSorting: true,
allowFiltering: true,
filterSettings: { type: 'Excel' },
allowGrouping: true,
groupSettings: {
captionTemplate: '#groupingheader-template',
showDropArea: false,
columns: ["PoLineNumber"]
},
enableHover: false,
allowSelection: false,
height: GetHistoryGridHeight(),
width: '100%',
columns: GetColumns(),
showColumnMenu: true,
columnMenuItems: ['SortAscending', 'SortDescending', 'AutoFit', 'AutoFitAll', 'Filter'],
enableVirtualization: true,
allowResizing: true,
resizeStop: function (args) {
var index = args.column.index;
$('.history-grid-group-headers td:nth-of-type(' + index + ')').outerWidth(args.column.width);
},
clipMode: "EllipsisWithTooltip",
gridLines: "Both",
}
检查来自 API 调用的数据表明正在接收与日期相关的数据作为字符串。添加以下函数将日期相关数据转换为日期类型。
data.forEach(function (d) {
if (d.LineApprovedDate != null) {
d.LineApprovedDate = new Date(d.LineApprovedDate);
}
})