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
sri vinod korlakunta 15sri vinod korlakunta 15 

Lightning Component Framework Specialist Step 3

Challenge Not yet complete... here's what's wrong: 
The BoatSearchResults JavaScript controller doesn't call the correct method. The controller must call helper.onSearch(), passing the component.


Anyone Completed this step Please help me with the Answer.
Best Answer chosen by sri vinod korlakunta 15
Santosh Reddy MaddhuriSantosh Reddy Maddhuri
Here is the controller : BoatSearchResultsController.js
({
    doSearch : function(component, event, helper) {
        component.get("v.boatTypeId");
        helper.onSearch(component, event, helper);
    },
   })

Here is the helper class :  BoatSearchResultsHelper.js

({
    onSearch : function(component, event, helper) {
        var boatTypId = component.get("v.boatTypeId");
        console.log("boatTypId--> " + boatTypId);
        // create an action
        var action = component.get("c.getBoats");
        action.setParams({boatTypeId:boatTypId});
        action.setCallback(this, function(response) {
            var state = response.getState();
            if(state == "SUCCESS") {
                console.log("response.getReturnValue() " + response.getReturnValue());
                component.set("v.boats", response.getReturnValue());
            } else {
                console.log("Failed with state: " + state);
            }
        });
        // Send action off to be executed
        $A.enqueueAction(action);
    }
})


This should work.