I'm just starting to learn SalesForce so forgive me if this question has an obvious answer. I've been creating a basic "display data in a table" component in the Developer Console. It catalogues movie posters just based on movie title and how many are in stock (count).
All I want to do is try out my code, but all I see in the "Poster" tab is the list of data I've made and not my component. How can I try out my code?
This is what I see:
Here is my Apex controller:
public class PostroApexController {
@AuraEnabled
public static List<Poster__c> getPosters(Id PosterID){
return [Select ID__c, Count__c, Name From Poster__c Where ID = :PosterID];
}
}
My XML component:
<aura:component controller="PostroApexController" implements="flexipage:availableForRecordHome" access="global">
Hello World
<aura:attribute name="Poster" type="Poster__c"/>
<aura:attribute name="Posters" type="List"/>
<aura:attribute name="Columns" type="List"/>
<aura:handler name="init" value="{!this}" action="{!c.performInit}"/>
<lightning:datatable data="{! v.Poster }" columns="{! v.Columns }" keyField="ID" hideCheckboxColumn="true"/>
</aura:component>
My JS controller:
({
performInit : function(component, event, helper) {
component.set("v.Columns", [
{label:"Poster Title", fieldName:"Name", type:"text"},
{label:"Count", fieldName:"Count__c"}
]);
var action = component.get("c.getPosters");
// set the args for getPosters(ID)
action.setParams({
PosterID: component.get("v.PosterID")
});
action.setCallback(this, function(data) {
component.set("v.Posters", data.getReturnValue());
});
$A.enqueueAction(action);
}
})
I'm looking for something that will let me see the data table I created in the component. Feel free to point out any other issues with my code too, I know it's awful and probably doesn't work.
Thank you!