【问题标题】:Bind multiple keys to a Table using template使用模板将多个键绑定到表
【发布时间】:2015-05-12 08:05:32
【问题描述】:

我想将多个键从 JSON 绑定到 sap.ui.table.Column
我正在使用 JSON 视图。这是它的样子:

{
  "Type": "sap.ui.core.mvc.JSONView",
  "content": [
    {
      "Type": "sap.ui.table.Table",
      "id": "backendConnectorsOverviewTable",
      "columns": [
        {
          "Type": "sap.ui.table.Column",
          "label": "Label",
          "template": {
            "Type": "sap.ui.commons.TextView",
            "text": "{text} {headerText}"
          }
        }
      ]
    }
  ]
}

这就是我的 Data-JSON 的样子:

{
  forms: [
    {
      text: "First Text"
    },
    {
      text: "Second Text"
    },
    {
      headerText: "Header Text"
    }
  ]
}

问题是,是否可以将 Table-Column 绑定到多个键,例如在我的情况下 text 和 headerText
我没有成功进行多项更改,例如:

"template": {
    "Type": "sap.ui.commons.TextView",
    "text": "{text} {headerText}"
  }

OR:

"template": {
    "Type": "sap.ui.commons.TextView",
    "text": "{/text} {/headerText}"
  }  

【问题讨论】:

    标签: javascript data-binding sapui5


    【解决方案1】:

    是的,这是可能的。试试这个:

    "template": {
        "Type": "sap.ui.commons.TextView",
        "text": "{ parts: [ { path: '/text' }, { path: '/headerText' } ] }"
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-03-27
      • 2012-07-09
      • 2017-07-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-10
      相关资源
      最近更新 更多