首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么WebIDE显示了Select的错误?

为什么WebIDE显示了Select的错误?
EN

Stack Overflow用户
提问于 2016-10-28 12:34:19
回答 1查看 1.6K关注 0票数 0

我用SAPUI5用WebIDE编写了一个应用程序。当我添加选择项到页面,它显示和错误,但程序可以运行没有错误,是什么原因在WebIDE中的错误?

守则的某些部分:

代码语言:javascript
复制
<mvc:View xmlns="sap.m" xmlns:mvc="sap.ui.core.mvc" xmlns:semantic="sap.m.semantic" xmlns:footerbar="sap.ushell.ui.footerbar" controllerName="xxx.controller.Worklist">
    <semantic:FullscreenPage id="page" navButtonPress="onNavBack" showNavButton="true" title="{i18n>worklistViewTitle}">
        <semantic:content>
            .....
        </semantic:content>
        <semantic:customFooterContent>
      // Here it shows error: Semantic Error: SAPUI5: The Association property is incorrect. Please enter the correct value. 
            <ActionSelect xmlns:sap.ui.core="sap.ui.core" selectedItem="Element sap.ui.core.ListItem#__item1" selectedKey="item1" selectedItemId="__item1" id="__select_lang">
                <items>
                    <sap.ui.core:ListItem text="English" key="EN" id="__item1"/>
                    <sap.ui.core:ListItem text="German" key="DE" id="__item2"/>
                </items>
            </ActionSelect>
        </semantic:customFooterContent>
    </semantic:FullscreenPage>
</mvc:View>

错误信息是:

错误:语义错误: SAPUI5:关联属性不正确。请输入正确的值。

我在所显示的代码中加了标签。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-10-29 08:23:39

它是selectedItem关联:它确实包含一个无效的值(在运行时被忽略)。

关联是通过XMLViews中元素的id设置的。

您正在使用三种方法一次预选一项。请只选一个。

  • selectedItem是一个关联,必须设置为所选项的id。很少使用这种聚合。
  • selectedKey必须设置为应该选择的项的键(在您的情况下是EN或DE )。
  • 必须将selectedItemId设置为应该选择的项的id。此属性通常优于selectedItem关联。

在您的示例中,应该是这样的:

代码语言:javascript
复制
<ActionSelect xmlns:sap.ui.core="sap.ui.core" selectedItemId="__item1" id="__select_lang">
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40305233

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档