输入:getSelectedKey 不是函数

Input: getSelectedKey is not a function

我目前在使用 sap.m.Input 和建议项目时遇到错误 当我点击建议列表时:

控制器

ch: function() {
  var filters = [];
  var TBLot = sap.ui.getCore().byId("idTableLot");
  var item = sap.ui.getCore().byId("prd").getSelectedKey();
  var filterL = new Filter("DCI", FilterOperator.EQ, item.toUpperCase());
  var filterWhs = new Filter("Magasin", FilterOperator.EQ, GlobalWarehouse);
  filters.push(filterL);
  filters.push(filterWhs);
  // ...
},

查看

var oItemTemplateP = new sap.ui.core.ListItem({
  key: "{ItemName}",
  additionalText: "{U_CMC_RP_CDC}",
  text: "{ItemName}"
});
new sap.m.Input({
  id: "prd",
  autocomplete: true,
  showSuggestion: true,
  enableSuggestionsHighlighting: true,
  suggestionItems: {
    path: "/itm",
    template: oItemTemplateP
  },
  change: [oController.ch, oController]
});

您使用的一定是旧版UI5。 getSelectedKey 方法是在 1.44 中引入的。要查看应用程序的 UI5 版本 运行,请按 Ctrl+Shift+Left Alt+P.