cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

MDK - Obtain section name from context in QueryOptions rule of ObjectTable

vtschouten97
Explorer
0 Likes
394

Hi fellow MDK developers,

Is there a way to obtain the section name of an ObjectTable through context in the QueryOptions rule of its Target? To illustrate the request: let's say we have multiple ObjectTable sections in a SectionedTable. I would like to dynamically determine the query options for each of the ObjectTable sections using the _Name property of the associated section.

Code below is from SSAM2410:

"Sections": [
				{
					"Search": {
						"Enabled": true,
						"Delay": 500,
						"MinimumCharacterThreshold": 3,
						"Placeholder": "$(L,search)",
						"BarcodeScanner": true
					},
					"EmptySection": {
						"Caption": "$(L,no_functional_location_available)"
					},
					"Header": {
		 				"UseTopPadding": false
    				},
					"ObjectCell": {
						"_Type": "Fragment",
        				"Fragment": "/SAPAssetManager/Pages/Fragments/FunctionalLocation/FunctionalLocationObjectCell.fragment",
						"Properties":{
							"ContextMenu": {
								"PerformFirstActionWithFullSwipe": true,
								"Items":"/SAPAssetManager/Rules/ContextMenuTable.js",
								"LeadingItems": "/SAPAssetManager/Rules/ContextMenuLeadingItems.js",
								"TrailingItems": "/SAPAssetManager/Rules/ContextMenuTrailingItems.js"
							}
						}
					},
					"Target": {
						"EntitySet": "MyFunctionalLocations",
						"Service": "/SAPAssetManager/Services/AssetManager.service",
                        "QueryOptions": "/SAPAssetManager/Rules/FunctionalLocation/FunctionalLocationQueryOptions.js"
					},
					"_Type": "Section.Type.ObjectTable",
					"_Name" : "FunctionalLocationListView"
				}
			],

In this specific example in query options rule FunctionalLocationQueryOptions.js, I would like ideally execute context.getName() and it would return 'FunctionalLocationListView' (assuming context is the input parameter of the FunctionalLocationQueryOptions rule). The context in this case is a SectionedTableProxy, and context.getParent() is undefined.

Is there a way to obtain the section name in such a way, or can this be made available? @bill_froelich ?

In the same vein: in an ImageCollection section, I would like to obtain the name of the current ImageCell (so not the section itself). Take the code example below:

{
                    "Header": {
                        "Caption": "Top Operation"
                    },
                    "ImageCell": {
                        "_Name": "WorkOrderImageCell",
                        "Title": "Workorders",
                        "Subtitle": "Subtitle",
                        "Attribute": "Attribute",
                        "Image": "sap-icon://favorite",
                        "ImageIsCircular": true,
                        "OnPress": "/MDKDevApp/Actions/Messages/Message1.action",
                        "Visible": "/MDKDevApp/Rules/ImageCellVisibility.js",
                        "Styles": {
                            "Image": "font-icon-class"
                        }
                    },
                    "Layout": {
                        "LayoutType": "HorizontalFit"
                    },
                    "_Name": "ImageCollectionSection",
                    "_Type": "Section.Type.ImageCollection"
                }

In the rule ImageCellVisibility.js, I would assume executing context.getName() to return 'WorkOrderImageCell', however it will return 'ImageCollectionSection'. 

Accepted Solutions (1)

Accepted Solutions (1)

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Likes

At this time the QueryOptions and Image Cell OnPress are returning a SectionTableProxy which does not give you a path to get the specific control name.  We have been adding more proxy classes to enable this type of capability as we go. 

As this functionality is currently not available in MDK standard control, I would suggest you to open a feature request here. We'll review it based on its priority.

vtschouten97
Explorer
0 Likes
Thanks for your reaction Bill. If opening a feature request is the way to go, then it appears that is what we should do. I do hope these proxy classes will be added in the future, this would facilitate certain developments to an immense extent.

Answers (0)