Bài đăng

Hiển thị các bài đăng có nhãn Id

[sapui5] aggregation binding - Use Control Visible instead removeItem or destroyItem

Hình ảnh
Hi, You may be working with binding items in table or list, we call it aggregation binding in common. You may encounter some case where you need to hide some item in the list. If it's the case, remember to look at my practice: User item's visibility instead of remove or destroy that item in the list. Because  remove  or  destroy will remove the item from the HTML document, but still leave the Id of the HTML object there. If you make some time to the table that changes the items, the table rebind and you will get id duplication error . On the other hands, if you just hide the item by using the visible property of ListBaseItem, the control is still there (only hidden). Which leads to no id error. ---V---

[sapui5] Cannot get control by control Id? See this post

Hello guys, You maybe sometime frustrated when getting ID of controls of the sapui5 framework, I got the same problem too, when I was starting to work with sapui5. The root cause that I found the most is forgetting declaring ID for the fragment. Because as sapui5 guideline mentioned, unlike View, Fragment's ID  is not generated automatically by the framework. You have to do it by yourself when you initiate the fragment. If you forgot to do this, you won't be able to get the fragment (or controls inside it) using sap.ui.Core.byId() later. Remember to use this line of code when initiate fragment: sap.ui.core.Fragment ( sFragmentId ,  sId ) But if you use other function, be aware of the order: sap.ui.xmlfragment ( sId,  sFragmentId ,  , oController ) Example: this.oDialog = sap.ui.xmlfragment( "createProcessDialog","com.HQ.app.test..fragment.CreateProcessDialog", this); More details can be found here: https://sapui5.hana.ondemand.com/sdk/#doc...