SAP UI5應(yīng)用里搜索功能的實(shí)現(xiàn)是怎樣的,針對(duì)這個(gè)問題,這篇文章詳細(xì)介紹了相對(duì)應(yīng)的分析和解答,希望可以幫助更多想解決這個(gè)問題的小伙伴找到更簡單易行的方法。
成都創(chuàng)新互聯(lián)主要從事成都做網(wǎng)站、網(wǎng)站建設(shè)、網(wǎng)頁設(shè)計(jì)、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務(wù)。立足成都服務(wù)濟(jì)源,十載網(wǎng)站建設(shè)經(jīng)驗(yàn),價(jià)格優(yōu)惠、服務(wù)專業(yè),歡迎來電咨詢建站服務(wù):18982081108
在一個(gè)包含了list的XML視圖里,使用SearchField標(biāo)簽頁定義一個(gè)搜索按鈕。點(diǎn)擊之后,執(zhí)行的事件處理函數(shù)為handleSearch:
<mvc:View controllerName="sapcp.cf.tutorial.app.controller.View1" xmlns:mvc="sap.ui.core.mvc" displayBlock="true" xmlns="sap.m"> <Shell id="shell"> <App id="app"> <pages> <Page id="page" title="{i18n>title}"> <subHeader> <Bar> <contentLeft> <SearchField search="handleSearch"/> </contentLeft> </Bar> </subHeader> <content> <List id="List" items="{/Products}"> <ObjectListItem type="Navigation" press="handleListItemPress" title="{ProductName}" number="{= ((${UnitPrice} * 100) / 100).toFixed(2) }" numberUnit="{i18n>currency}"> <attributes> <ObjectAttribute text="{QuantityPerUnit}"/> </attributes> <firstStatus> <ObjectStatus text="{= ${Discontinued}? 'Discontinued' : 'Available' }" state="{= ${Discontinued}? 'Error' : 'Success' }"/> </firstStatus> </ObjectListItem> </List> </content> </Page> </pages> </App> </Shell> </mvc:View>
```
在視圖的控制器里實(shí)現(xiàn)這個(gè)搜索函數(shù):
```JavaScript
sap.ui.define([ "sap/ui/core/mvc/Controller", "sap/m/MessageBox" ], function (Controller, MessageBox) { "use strict"; return Controller.extend("sapcp.cf.tutorial.app.controller.View1", { onInit: function () { }, // show in a pop-up which list element was pressed handleListItemPress: function (oEvent) { var oRouter = sap.ui.core.UIComponent.getRouterFor(this); var selectedProductId = oEvent.getSource().getBindingContext().getProperty("ProductID"); oRouter.navTo("Detail", { productId: selectedProductId }); } }); });
```
測試:
搜索能夠按照期望的工作:
關(guān)于SAP UI5應(yīng)用里搜索功能的實(shí)現(xiàn)是怎樣的問題的解答就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道了解更多相關(guān)知識(shí)。
新聞名稱:SAPUI5應(yīng)用里搜索功能的實(shí)現(xiàn)是怎樣的
路徑分享:http://www.rwnh.cn/article8/psjoip.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供響應(yīng)式網(wǎng)站、網(wǎng)站內(nèi)鏈、網(wǎng)站收錄、關(guān)鍵詞優(yōu)化、建站公司、微信小程序
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)