如何在角度光滑网格中更改标签度量?



我尝试在角度光滑网格中更改页脚标签指标。
在此处
输入图像描述 代码:

this.gridOptions = {
showCustomFooter: true,
customFooterOptions: {
metricTexts: {
items: 'items1',
of: 'of1',
}
}
}

但结果当我使用angular.slickgrid.getOptions()时,我没有得到任何变化。

...
metricText: {
items: "items"
itemsKey: "ITEMS"
lastUpdate: "Last Update"
of: "of"
ofKey: "OF"
}
...

我预计此示例代码会更改我的标签指标

软件版本
角度 : 9.0
角度光滑网格 : 2.18.6
打字稿 : 3.75

请注意,我是Angular-Slickgrid的作者

这是库本身中的一个错误,现在在最新版本 2.18.7 中已修复。

您的使用是对的,我将再次将它们放在这里,以帮助其他人,并在您使用(或不使用(翻译服务(ngx-translate(时更加强调差异。主要区别在于,任何时候你想在Angular-Slickgrid中使用翻译,那么你都会有属性/选项,这些属性/选项通常以Key后缀结尾(例如:itemsKey: 'ITEMS'nameKey: 'NAME',...(。

无翻译服务

this.gridOptions = {
showCustomFooter: true, 
customFooterOptions: {
metricTexts: {
items: 'custom items',
of: 'custom of',
lastUpdate: 'custom update',
},
dateFormat: 'yyyy-MM-dd hh:mm aaaaa'm'',
hideTotalItemCount: false,
hideLastUpdateTimestamp: false,
},
};

使用翻译服务

this.gridOptions = {
enableAutoResize: true,
i18n: this.translate, // <-- Translate Service
showCustomFooter: true, 
customFooterOptions: {
metricTexts: {
itemsKey: 'CUSTOM_ITEMS_KEY',
ofKey: 'CUSTOM_OF_KEY',
lastUpdateKey: 'CUSTOM_LAST_UPDATE_KEY',
},
dateFormat: 'yyyy-MM-dd hh:mm aaaaa'm'',
hideTotalItemCount: false,
hideLastUpdateTimestamp: false,
},
};

最新更新