on 2024 Sep 16 8:38 PM
Hello community !
I have an MDK application which on the home page has a Card Collection:
When you click on one of the cards, navigation to a details page is activated:
But when I get to this screen, I see everything empty:
How can I access the object I select? Is there a way to send the object ID between views and access specific information about a particular object? In the detail view I am using "Key Value Item" type controls.
Navigation is simple, I don't know if I need to configure something extra here:
Thanks for your help !
Request clarification before answering.
MDK will automatically pass the selected object as the default object binding to the next page.
In this case, from your screen shots it looks like the Card Collection is bound to the NOTICIA entity set. This means that the selected record from the NOTICIA entity set will be the default object for the detail page. The binding in the KeyValue should then just need to be the property name under NOTICIA.
In your screen shot it looks like you are binding to {NOTICIA/TITULO} and {NOTICIA/CUERPO}. Given that the default object is a record in NOTICIA. The binding should then just need to be {TITULO} and {CUERPO}.
Give that a shot and see if it works then.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, this is the complete definition:
{
"Controls": [
{
"FilterFeedbackBar": {
"ShowAllFilters": false,
"_Type": "Control.Type.FilterFeedbackBar"
},
"_Type": "Control.Type.SectionedTable",
"_Name": "SectionedTable0",
"Sections": [
{
"Separators": {
"TopSectionSeparator": false,
"BottomSectionSeparator": true,
"HeaderSeparator": true,
"FooterSeparator": true,
"ControlSeparator": true
},
"KeyAndValues": [
{
"Value": "{TITULO}",
"DataSubscriptions": [],
"_Name": "KeyValueItem0",
"KeyName": "Título",
"Visible": true
}
],
"MaxItemCount": 1,
"_Type": "Section.Type.KeyValue",
"_Name": "SectionKeyValue0",
"Visible": true,
"EmptySection": {
"FooterVisible": false
},
"Layout": {
"NumberOfColumns": 2
}
},
{
"Separators": {
"TopSectionSeparator": false,
"BottomSectionSeparator": true,
"HeaderSeparator": true,
"FooterSeparator": true,
"ControlSeparator": true
},
"KeyAndValues": [
{
"Value": "{CUERPO}",
"_Name": "KeyValueItem1",
"KeyName": "Noticia",
"Visible": true
}
],
"MaxItemCount": 1,
"_Type": "Section.Type.KeyValue",
"_Name": "SectionKeyValue1",
"Visible": true,
"EmptySection": {
"FooterVisible": false
},
"Layout": {
"NumberOfColumns": 2
}
},
{
"Separators": {
"TopSectionSeparator": false,
"BottomSectionSeparator": true,
"HeaderSeparator": true,
"FooterSeparator": true,
"ControlSeparator": true
},
"Layout": {
"LayoutType": "Vertical",
"HorizontalAlignment": "Leading"
},
"_Type": "Section.Type.ButtonTable",
"_Name": "SectionButtonTable0",
"Visible": true,
"EmptySection": {
"FooterVisible": false
},
"Buttons": [
{
"Styles": {
"Button": "MainButton"
},
"_Type": "ButtonTable.Type.Button",
"_Name": "ButtonTableTypeButton0",
"Title": "No me gusta",
"Alignment": "Center",
"ButtonType": "Text",
"Semantic": "Tint",
"Image": "sap-icon://heart-2",
"ImagePosition": "Leading",
"FullWidth": true,
"Visible": true,
"Enabled": true
}
]
}
]
}
],
"DesignTimeTarget": {
"Service": "/BTP6S/Services/obfuscated-mdk-btp6s.service",
"EntitySet": "NOTICIA"
},
"_Type": "Page",
"_Name": "Noticias_Detail",
"Caption": "Noticia",
"PrefersLargeCaption": true
}
Yes, I have confirmed there appears to be a bug related to the context / binding on the Card Collection. You can work around it using a rule to set the action binding based on the selected card in the short term and I will open an internal issue to work on a solution.
Here is an example rule that gets the card binding and calls setActionBinding() to correctly set the default binding object before navigating to the next page.
/**
* Describe this function...
* @Param {IClientAPI} context
*/
export default function CardToDetail(context) {
let selectedCard = context.getParent().binding;
context.getPageProxy().setActionBinding(selectedCard);
context.getPageProxy().executeAction({
"Name": '/SCN_00033/Actions/GenericNavigation.action',
"Properties": {
"PageToOpen": "/SCN_00033/Pages/SampleServiceV4_SalesOrderItems/SalesOrderItems_Detail.page"
}
});
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @emorales
Remove _Type": "ButtonTable.Type.Button" from the page definition and give it a try. I am able to build the page, sharing screenshot below.
I am sharing the updated version of the page file below for your reference.
{
"Controls": [
{
"FilterFeedbackBar": {
"ShowAllFilters": false,
"_Type": "Control.Type.FilterFeedbackBar"
},
"_Type": "Control.Type.SectionedTable",
"_Name": "SectionedTable0",
"Sections": [
{
"Separators": {
"TopSectionSeparator": false,
"BottomSectionSeparator": true,
"HeaderSeparator": true,
"FooterSeparator": true,
"ControlSeparator": true
},
"KeyAndValues": [
{
"Value": "{TITULO}",
"DataSubscriptions": [],
"_Name": "KeyValueItem0",
"KeyName": "Título",
"Visible": true
}
],
"MaxItemCount": 1,
"_Type": "Section.Type.KeyValue",
"_Name": "SectionKeyValue0",
"Visible": true,
"EmptySection": {
"FooterVisible": false
},
"Layout": {
"NumberOfColumns": 2
}
},
{
"Separators": {
"TopSectionSeparator": false,
"BottomSectionSeparator": true,
"HeaderSeparator": true,
"FooterSeparator": true,
"ControlSeparator": true
},
"KeyAndValues": [
{
"Value": "{CUERPO}",
"_Name": "KeyValueItem1",
"KeyName": "Noticia",
"Visible": true
}
],
"MaxItemCount": 1,
"_Type": "Section.Type.KeyValue",
"_Name": "SectionKeyValue1",
"Visible": true,
"EmptySection": {
"FooterVisible": false
},
"Layout": {
"NumberOfColumns": 2
}
},
{
"Separators": {
"TopSectionSeparator": false,
"BottomSectionSeparator": true,
"HeaderSeparator": true,
"FooterSeparator": true,
"ControlSeparator": true
},
"Layout": {
"LayoutType": "Vertical",
"HorizontalAlignment": "Leading"
},
"_Type": "Section.Type.ButtonTable",
"_Name": "SectionButtonTable0",
"Visible": true,
"EmptySection": {
"FooterVisible": false
},
"Buttons": [
{
"Styles": {
"Button": "MainButton"
},
"_Name": "ButtonTableTypeButton0",
"Title": "No me gusta",
"Alignment": "Center",
"ButtonType": "Text",
"Semantic": "Tint",
"Image": "sap-icon://heart-2",
"ImagePosition": "Leading",
"FullWidth": true,
"Visible": true,
"Enabled": true
}
]
}
]
}
],
"DesignTimeTarget": {
"Service": "/BTP6S/Services/obfuscated-mdk-btp6s.service",
"EntitySet": "NOTICIA"
},
"_Type": "Page",
"_Name": "Noticias_Detail",
"Caption": "Noticia",
"PrefersLargeCaption": true
}
Thank you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
31 | |
10 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.