function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Dora Babu KOTTHRU 7Dora Babu KOTTHRU 7 

The campingList JavaScript controller doesn't have a 'doInit' function or doesn't call the Apex controller to get items from the database.

Though my campingList JavaScript controller have doInit , I am getting 'doInit' function or doesn't call the Apex controller to get items from the database. Not sure what went wrong.  Please help me. 

({
       doInit: function(component, event, helper) {
        // Create the action
        var action = component.get("c.getItems");
    // Add callback behavior for when response is received
        action.setCallback(this, function(response) {
        var state = response.getState();
        if (component.isValid() && state === "SUCCESS") {
            //component.set("v.item", response.getReturnValue());
            helper.controllerHelper(component,response.getReturnValue());
        }
        else {
            console.log("Failed with state: " + state);
        }
        });
    // Send action off to be executed
    $A.enqueueAction(action);
},
    
clickCreateCamping: function(component, event, helper) {    
        if(helper.validateCampingForm(component)){
            var newCamping = component.get("v.newItem");
            helper.createItem(component, newCamping);
        }

    }
})