SAP UI5 responsiveLayout和responsiveGridLayout的区别
今天我打開我的SAP UI5應(yīng)用,激活support assistant后,發(fā)現(xiàn)一條警告信息:ResponsiveLayout should not be used any longer because of UX requirements
這條信息的提示字段resolution告訴了我正確做法:Use the ResponsiveGridLayout instead
并給出參考鏈接:https://sapui5.hana.ondemand.com/#/api/sap.ui.layout.form.ResponsiveLayout
The ResponsiveLayout renders a Form with a responsive layout. Internally the ResponsiveFlowLayout is used. The responsiveness of this layout tries to best use the available space. This means that the order of the FormContainers, labels and fields depends on the available space.
ResponsiveLayout將form渲染成響應(yīng)式布局,內(nèi)部實現(xiàn)采用了ResponsiveFlowLayout,這種類型的布局將試圖最大化地利用可用頁面空間,意味著FormContainers,標簽和字段的順序依賴于可用空間。
On the FormContainers, FormElements, labels and content fields, ResponsiveFlowLayoutData can be used to change the default rendering.
We suggest using the ResponsiveGridLayout instead of this layout because this is easier to consume and brings more stable responsive output.
現(xiàn)在SAP推薦使用ResponsiveGridLayout來替代ResponsiveLayout,因為前者能產(chǎn)生更穩(wěn)定的響應(yīng)式布局。
而ResponsiveGridLayout內(nèi)部使用的是Grid控件。
這個錯誤是如何被檢測出來的呢?
代碼如下:
check: function (oIssueManager, oCoreFacade, oScope) {oScope.getElementsByClassName("sap.ui.layout.form.Form").forEach(function (oForm) {var oLayout = oForm.getLayout();if (oLayout && oLayout.isA("sap.ui.layout.form.ResponsiveLayout")) {var oParent = oForm.getParent();var sId;var sName = "Form";if (isSimpleForm(oParent)) {sId = oParent.getId();sName = "SimpleForm";} else if (isSmartForm(oParent)) {// for SmartForm don't check on Form levelreturn;} else {sId = oForm.getId();}oIssueManager.addIssue({severity: Severity.Medium,details: sName + " " + sId + " uses ResponsiveLayout.",context: {id: sId}});}});},首先用JavaScript原生DOM API oScope.getElementsByClassName(“sap.ui.layout.form.Form”)拿到所有類為sap.ui.layout.form.Form的標簽,然后忽略SmartForm的檢測,最后獲得form的ID,打印到support Assistant上。
要獲取更多Jerry的原創(chuàng)文章,請關(guān)注公眾號"汪子熙":
總結(jié)
以上是生活随笔為你收集整理的SAP UI5 responsiveLayout和responsiveGridLayout的区别的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ABAP WebService SRT框
- 下一篇: 不忘老友!一加近三年所有机型全面升级Co