0

Here is components to this app The App

<aura:application extends="force:slds" >
  <c:listOfMenu />

</aura:application>

Here is ListOfMenu Component

<aura:component controller="MenuItemsController" implements="flexipage:availableForAllPageTypes,force:hasRecordId" access="global" >

<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<aura:attribute name="menuList" type="eioApp__Menu__c[]"/>
<lightning:card title="Menu Items"/>
<aura:iteration items="{!v.menuList}" var="item">
    <div>

        <p>{!item.eioApp__price__c}</p>

    </div>

</aura:iteration>

Here is the controller for the component

({
doInit : function(component, event, helper) {
    var action = component.get("c.getMenuRecords");
    action.setCallback(this,function(data){
        var state = data.getState();
        if(state==="SUCCESS"){
            component.set("v.menuRecods",data.getReturnValue());
        }
    })
    $A.enqueueAction(action);


}

})

Here is the apex controller class

public class MenuItemsController {
@AuraEnabled
public List<eioApp__menu__c> getMenuRecords(){
   return [Select name,eioApp__price__c,eioApp__image__c From eioApp__Menu__c Limit 10];



}

}

  • Please edit to clarify what the problem is with this code and what you're trying to do with your namespace. – David Reed Oct 23 '19 at 16:25
  • Okay. I just did. – scylla Oct 23 '19 at 16:34
  • @scylla It's not clear as what are you trying to achieve. With the information that you have here it seems that you have a namespace (eioApp) enabled org. What is that you want to achieve here? With the code you have are you saying it does not work? What is the exact issue, which component, line no., etc.? I do see that you are using an incorrect attribute name in the JS controller component.set("v.menuRecods",data.getReturnValue()); whereas you have declared it on the component as menuList, is that causing issue here? You will need to provide such details for anyone to be able to help. – Jayant Das Oct 23 '19 at 17:07
0

You don't need (and generally do not want!) explicit namespace references in your source code in this manner.

Doing so prevents you from developing your application in ordinary, non-namespaced scratch orgs and developer editions. If you have explicit namespace references, you're required to do all your development work in namespaced orgs. Once you package your application, Salesforce is good in most cases at implying the namespace references for you.

In particular, you don't need a namespace reference on a controller action reference. It should always be "c.method_name" as you have it here. Likewise, you don't need the namespace on the declaration of the controller for this Lightning component, controller="MenuItemsController".

It's not clear to me exactly what the problem is here. It could be as mundane as that the copy of your Apex class on the server is out of date and lacks a method you've written locally. I don't think it has anything to do with a namespace.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.