Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/428.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用JS和XML更改文本控件中的OData值_Javascript_Xml_Sapui5_Export To Csv - Fatal编程技术网

Javascript 使用JS和XML更改文本控件中的OData值

Javascript 使用JS和XML更改文本控件中的OData值,javascript,xml,sapui5,export-to-csv,Javascript,Xml,Sapui5,Export To Csv,结果最初显示在文本控件中,然后乘以从Odata加载并显示在输入控件中的价格和数量。目标是,在将新价格和新数量输入到输入控件后,结果应该在文本控件中自动更新。使用_onChange(),我可以更改OData的属性(在本例中是price和quantity)(我已经看到了更新的属性并在调试器模块中得到了结果)。但是更新后的结果不会显示在文本控件中,有人知道吗 <t:Column> <Text text="Price"/> <t:template>

结果最初显示在文本控件中,然后乘以从Odata加载并显示在输入控件中的价格和数量。目标是,在将新价格和新数量输入到输入控件后,结果应该在文本控件中自动更新。使用_onChange(),我可以更改OData的属性(在本例中是price和quantity)(我已经看到了更新的属性并在调试器模块中得到了结果)。但是更新后的结果不会显示在文本控件中,有人知道吗

<t:Column>
    <Text text="Price"/>
     <t:template>
        <Input id="price" value="{Prc}" editable="true"  change="_onChange"/>
     </t:template>
</t:Column>
<t:Column>
    <Text text="Quantity"/>
     <t:template>
        <Input id="quantity" value="{Qty}" editable="true"  change="_onChange"/>
     </t:template>
</t:Column>
XML:

<t:Column>
    <Text text="Price"/>
     <t:template>
        <Input id="price" value="{Prc}" editable="true"  change="_onChange"/>
     </t:template>
</t:Column>
<t:Column>
    <Text text="Quantity"/>
     <t:template>
        <Input id="quantity" value="{Qty}" editable="true"  change="_onChange"/>
     </t:template>
</t:Column>

如果您在模型中有绑定结果,请使用该结果更新模型。

我已解决该问题。
<t:Column>
    <Text text="Price"/>
     <t:template>
        <Input id="price" value="{Prc}" editable="true"  change="_onChange"/>
     </t:template>
</t:Column>
<t:Column>
    <Text text="Quantity"/>
     <t:template>
        <Input id="quantity" value="{Qty}" editable="true"  change="_onChange"/>
     </t:template>
</t:Column>
问题是:oEvent找不到我为输入定义的控件id(在本例中为
id=“quantity”
),因为控件id是动态生成的(在本例中为:
id=“\uu xmlview1--TBL\u ep”
)。为了定义这个动态id,我们需要使用
var oSTBL_EP=this.getView().byId(“数量”),然后调用oSTBL_EP的属性sId。
只有使用有效Id,该值才能在文本控件中可见

<t:Column>
    <Text text="Price"/>
     <t:template>
        <Input id="price" value="{Prc}" editable="true"  change="_onChange"/>
     </t:template>
</t:Column>
<t:Column>
    <Text text="Quantity"/>
     <t:template>
        <Input id="quantity" value="{Qty}" editable="true"  change="_onChange"/>
     </t:template>
</t:Column>