绑定输入字段不起作用

时间:2014-11-19 14:16:14

标签: sapui5

当我尝试在我的视图中映射模型时遇到问题。 我有一个视图包含

    <form:SimpleForm
        minWidth="1024"
        maxContainerCols="2"
        editable="true"
        layout="ResponsiveGridLayout"
        title="Dimensione prodotto"
        labelSpanL="3"
        labelSpanM="3"
        emptySpanL="4"
        emptySpanM="4"
        columnsL="1"
        columnsM="1"
        class="editableForm">

        <Label text="Codice" />
        <Input value="{elements/idCodProd/value}" id="idCodProd" />
        <Label text="Descrizione" />
        <Input value="{idDescProd/value}" id="idDescProd" />
        <Label text="Famiglia" />
        <Input value="{idFamiglia/value}" id="idFamiglia" />

    </form:SimpleForm>

和这个模型 (JSONModel)

{
    "elements":{
        "idCodProd":{
            "id":"idCodProd",
            "enabled":true,
            "required":true,
            "value":"123"
        },
        "idDescProd":{
            "id":"idDescProd",
            "enabled":true,
            "required":true
        },
        "idFamiglia":{
            "id":"idFamiglia",
            "lookup":"TAB_FAM",
            "enabled":true,
            "required":true
        }
    }
}

如何在输入中剔除idCodProd的值? 我正确地将模型设置为视图,但在第一个输入中我看不到“123”

1 个答案:

答案 0 :(得分:2)

好的,我解决了我的问题: 我将{elements/idCodProd/value}替换为{/elements/idCodProd/value}