If you leave out the fragment’s id property you get this, so it works. To make Id work, it would need to look like: componentID-viewID-controlID So when you give a fragment an ID, the fragment’s control ID looks like this: componentID-viewID-fragmentID-controlID SAPUI5 prefixes every control in the following manner: componentID > viewID > Control1ID > Control2ID > ControlernID. Id(“text1”) doesn’t work because if you give the fragment an ID separately, the fragment gets prefixed not only with the view ID of the fragment’s view, but also with the fragment’s ID. This is because the fragment has an id property: Plus the view’s controller: // in your controller Here’s an XML view with the embedded XML fragment and button: Let’s start with an XML view: Getting a Control by its ID from a Fragment created in an XML Viewįor example, the requirement is to get a text from a fragment on a button click.Īctually, it’s simple-but there’s a problem: SAPUI5’s internal ID generations. Let’s dive right in! Getting a Control by Its ID From a Fragment in SAPUI5įirst, you need to differentiate whether you created the XML fragment via an XML view or controller. So if you want to learn how to get a control from a fragment, then you’re in the right place. How you access controls in a fragment depends on how you created it. This is how to get a control from a fragment in a controller in SAPUI5. Getting a Control by its ID from a Fragment created in a Controller.Getting a Control by its ID from a Fragment created in an XML View.Getting a Control by Its ID From a Fragment in SAPUI5.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |