Skip to Content

Edit/Display mode for Object Page Blocks (UI5)

Hello colleagues,

Could you help me with the Object Page Block (BlockBase.js) mode property?

When I click at the edit button in the object page layout, I wanted to change some of the blocks, which contain forms from display to change mode and backwards. In the 1.40 version of API, the following written about getMode() method of BlockBase:

The mode of the block is changed when SubSection mode changes.

Sub Section Mode has only to values to select from: Collapsed and Expanded (sap.uxap.ObjectPageSubSectionMode).

How do I set other view for other modes?

Now, I do it like that:

	var newBlock = BlockBase.extend("...newBlock", {
		metadata: {
			views: {
				Expanded: {
					viewName: "...DisplayBlock",
					type: "XML"
				},
				Collapsed: {
					viewName: "...DisplayBlock",
					type: "XML"
				},
				Display: {
					viewName: "...DisplayBlock",
					type: "XML"					
				},
				Edit: {
					viewName: "...ChangeBlock",
					type: "XML"		
				}				
			}
		}
	});

Then, I change mode property in the controller:

this.getView().byId("newBlock").setMode("Edit");

It works but...What's a proper way?

Thanks,

Ilya

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers