SAPUI5:如何更新SelectedKey上的显示更改?

问题描述 投票:0回答:1

我有显示信息的问题。我需要设置Drop box.的值

来自clothing.json的代码

{
  "catalog": {
    "clothing": {
      "categories": [
        {"name": "Women", "categories": [
          {"name":"Clothing", "categories": [
            {"name": "Dresses", "categories": [
              {"name": "Casual Red Dress", "amount": 16.99, "currency": "EUR", "size": "S"},
              {"name": "Short Black Dress", "amount": 47.99, "currency": "EUR", "size": "M"},
              {"name": "Long Blue Dinner Dress", "amount": 103.99, "currency": "USD", "size": "L"}
            ]},

来自View.xml的代码

<Column id="colSize" width="11rem">
  <m:Label text="Size"/>
  <template>
     <m:Select
        id = "selSize"
        selectedKey="{size}"
        items="{path: '/sizes', templateShareable: true}"
        visible="{= !!${size}}"
        forceSelection="false">
        <core:Item key="{key}" text="{value}"/>
      </m:Select>
   </template>
 </Column>

并从Controller.js部分代码

    onPressBtnSetSize: function() {
        var oComboBox = this.byId("cbxSelectSize"),
            sKey = oComboBox.getSelectedItem().getKey(),
            oSelect = this.byId("selSize");
            oSelect.setSelectedKey(sKey);       
    }

现在,当我调用方法getSelectedKey()。我明白我的sKey的意思。但表中的显示不会改变。

我认为你需要更新或刷新表。但我所有的尝试都失败了。请帮忙!

sapui5 html-select
1个回答
-1
投票
    id = "selSize"
    ...
    var oComboBox = this.byId("cbxSelectSize"),

?

© www.soinside.com 2019 - 2024. All rights reserved.