【问题标题】:Add checkboxes in SAPUI5 list在 SAPUI5 列表中添加复选框
【发布时间】:2016-12-22 12:28:32
【问题描述】:

尊敬的 SAPUI5 开发人员,

我做了一个主细节申请。

我想为选择多个项目然后按删除按钮的用户提供此功能。

为此,我需要在列表项前添加一些复选框。列表的数据来自 OData 服务。

这是列表的代码:

<List id="list" items="{ path: '/GewerkSet', sorter: { path: 'ZTradeName', descending: false }, groupHeaderFactory: '.createGroupHeader' }" busyIndicatorDelay="{masterView>/delay}" noDataText="{masterView>/noDataText}" mode="{= ${device>/system/phone} ? 'None' : 'SingleSelectMaster'}" growing="true" growingScrollToLoad="true" updateFinished="onUpdateFinished" selectionChange="onSelectionChange">
<infoToolbar>
    <Toolbar active="true" id="filterBar" visible="{masterView>/isFilterBarVisible}" press="onOpenViewSettings">
        <Title id="filterBarLabel" text="{masterView>/filterBarLabel}"/>
    </Toolbar>
</infoToolbar>
<items>
    <ObjectListItem type="{= ${device>/system/phone} ? 'Active' : 'Inactive'}" press="onSelectionChange" title="{ZTradeName}" showMarkers="true"/>
</items>
</List> 

这是我需要的图片。请注意列表项前面的复选框:

【问题讨论】:

    标签: checkbox sapui5


    【解决方案1】:

    您只需将items 更改为CustomListItem

    <List id="list" items="{ path: '/GewerkSet', sorter: { path: 'ZTradeName', descending: false }, groupHeaderFactory: '.createGroupHeader' }" busyIndicatorDelay="{masterView>/delay}" noDataText="{masterView>/noDataText}"
                mode="{= ${device>/system/phone} ? 'None' : 'SingleSelectMaster'}" growing="true" growingScrollToLoad="true"
                updateFinished="onUpdateFinished" selectionChange="onSelectionChange">
    <infoToolbar>
        <Toolbar active="true" id="filterBar" visible="{masterView>/isFilterBarVisible}" press="onOpenViewSettings">
            <Title id="filterBarLabel" text="{masterView>/filterBarLabel}"/>
        </Toolbar>
    </infoToolbar>
    <CustomListItem type="Inactive">
        <CheckBox text="{ZTradeName}" press="onSelectionChange" showMarkers="true"/>
    </CustomListItem>
    

    我测试了它,它工作正常。这是输出的图片:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-30
      • 1970-01-01
      • 2011-05-12
      • 2016-12-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多