2016-06-27 48 views
0

我想换一个专栏中,我有这个绑定表我对现在的结合,例如:通过按下一个按钮,我通过点击一个按钮,更改表的绑定

<t:Column id="orderId" hAlign="Center"> 
          <Label id="labelOrderId" text="{i18n>transactionId}"/> 
          <t:template> 
           <Text text="{id}"/> 
          </t:template> 
         </t:Column> 

想要将其更改为此绑定:

<t:Column id="orderId" hAlign="Center"> 
          <Label id="labelOrderId" text="{i18n>transactionId}"/> 
          <t:template> 
           <Text text="{newTransactionId}"/> 
          </t:template> 
         </t:Column> 

有没有可能改变这种情况?

回答

1

如果要解除绑定属性并将其绑定到另一个数据属性,可以使用unbindPropertybindProperty方法。要详细了解如何使用这些方法,可以查看this page about property binding

在你的情况下,它会导致相当复杂的代码,因为你的字段被嵌入在一个表中,你必须找到你需要先改变的表行。

虽然您可能想要考虑表达式绑定。在你的例子中,当newTransactionId不存在时,你似乎只想显示旧的id。如果是这样的话,你的表达结合看起来是这样的:

{= ${newTransactionId} ? ${newTransactionId} : ${id} } 

要了解更多有关表达式绑定,你可以看看Step 22 of the SAPUI5 walkthrough,它描述了表达结合得非常好。

+0

耶稣基督你从哪里得到所有这些知识,完美! – ECasio