【发布时间】:2026-02-07 11:30:01
【问题描述】:
我正在制作一个表格,其中一部分是填写电话号码。我想将此输入分成两部分,一方面是带有所有国家/地区前缀的选择器(我从 json 获取信息),另一方面是带有数字限制的普通输入。问题是,由于有很多前缀,我想看看是否有办法用选择过滤数字,因为使用组合框我可以过滤问题是它脱离了表格并且尺寸不好,但是选择一切正常。我已经尝试了这三种方法,但是第一种方法我认为不是最好的,第二种方法我找不到结果,第三种方法超出了单元格的宽度。对选择有什么想法吗?
<VBox>
<Label class="label" text="{i18n>Phone}" required="true"/>
<HBox>
<SearchField id="prefix" placeholder="Prefijo" enableSuggestions="true" search=".onSearch" suggest=".onSuggest" suggestionItems="{ path: 'country>/Dato' }">
<SuggestionItem text="{country>prefix}" key="{country>code}"/>
</SearchField>
<!--<Select id="prefix" items="{ path: 'country>/Dato' }">
<core:ListItem key="{country>code}" text="{country>prefix}"/>
</Select>-->
<!--<ComboBox id="prefix" class="input" width="30%" required="true" items="{ path: 'country>/Dato' }">
<core:ListItem key="{country>code}" text="{country>prefix}"/>
</ComboBox>-->
<Input id="phone" placeholder="{i18n>Phone}" value="" class="input phone" type="Tel" required="true" maxLength="10" liveChange="handleLiveChange"></Input>
</HBox>
<layoutData>
<l:GridData span="L6 M6 S12"/>
</layoutData>
</VBox>
【问题讨论】:
-
请提供一个可重现的最小示例,并详细解释当前行为和预期行为。 *.com/help/minimal-reproducible-example
标签: select search filter combobox sapui5