You need to create a component that is specifically for your detail object. It takes an attribute that is the master items ID. Place this component inside the master item component.
You then create a getSubItems function that executes in the doIt. Since you now have the master item Id, you can use that in your function call on the client and the server.
//client controller for c:ListDetailITems
getDetailItems : function(component) {
var action = component.get("c.getDetailItemsDB");
var masterItemId = component.get('v.masterItemId');
action.setParams({ "masterItemId" : masterItemId});
action.setCallback(this, function(response) {
var state = response.getState();
if(component.isValid() && state == "SUCCESS") {
component.set("v.detailItems", response.getReturnValue());
}
});
$A.enqueueAction(action);
},
//Apex server controller
public with sharing class ListDetailItemsApexController {
@AuraEnabled
public static List<detailItem> getDetailItemsDB(String masterItemId) {
return [SELECT Id, IsDeleted, Name,
//other fields for your SOQL
FROM detailItem
WHERE masterItem =: masterItemId];
}
}
Hope this will help you with the above issue.
Kindly mark this as solved if the reply was helpful so that it gets removed from the unanswered queue which results in helping others who are encountering a similar issue.
You need to create a component that is specifically for your detail object. It takes an attribute that is the master items ID. Place this component inside the master item component. Pass the detailItem List and masterItemId into the c:detailItem to be iterated over. You then create a getSubItems function that executes in the doIt. Since you now have the master item Id, you can use that in your function call on the client and the server. Hope this will help you with the above issue.
Kindly mark this as solved if the reply was helpful so that it gets removed from the unanswered queue which results in helping others who are encountering a similar issue.
Thanks,
Nagendra