咱們在本地 Visual Studio Code 裏, 按照下面兩篇文章,完成了 SAP UI5 的應用開發,npm
最後能獲得一個列表,效果以下:mvc
本文咱們使用 SAP UI5 提供的 Smart 控件來繼續豐富這個應用。ide
從下面三個 namespace 引入 Smart 控件:ui
xml view 的實現源代碼:spa
<mvc:View controllerName="tutorial.products.controller.Products" displayBlock="true" xmlns="sap.m" xmlns:smartFilterBar="sap.ui.comp.smartfilterbar" xmlns:smartList="sap.ui.comp.smartlist" xmlns:smartTable="sap.ui.comp.smarttable" xmlns:mvc="sap.ui.core.mvc"> <Page id="Products"> <smartFilterBar:SmartFilterBar id="smartFilterBar" persistencyKey="UniqueAndStablePersistencyKey" entitySet="Products" considerSelectionVariants="true" /> <smartList:SmartList id="smartProductList" smartFilter="smartFilterBar" entitySet="Products" expandFields="Category" header="Products List" showRowCount="true" showFullScreenButton="true" enableAutoBinding="true"> <smartList:listItemTemplate> <StandardListItem id="listTemplate" type="Navigation" press="handleListItemPress" title="{ProductName}" info="{= ${UnitPrice} + ' €' }" description="{Category/CategoryName}" /> </smartList:listItemTemplate> </smartList:SmartList> </Page> </mvc:View>
npm run start 啓動工
程,最後看到的 Smart List:命令行
Smart Filter 控件提供的開箱即用的功能:code
更多Jerry的原創文章,盡在:"汪子熙":xml