0

我尝试在 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

4

1 回答 1

0

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

这是 lib 本身的一个错误,现在已在最新版本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,
  },
};
于 2020-05-26T14:35:46.003 回答