我想在angular slickgrid中改变页脚标签的度量。 在这里输入图片描述 编码。
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"
}
...
我希望这个示例代码能改变我的标签度量值
软件版本: Angular : 9.0 Angular-Slickgrid : 2.18.6 TypeScript: 3.75
请注意,我是 Angular-Slickgrid
这是lib本身的一个bug,现在在最新的版本中得到了修正。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,
},
};