• Mohammad Shahid Shah
  • NEWBIE
  • 10 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies
 I''m struck on Step 1 

User-added imageHere's my code ):
Can someone please help me out !

User-added image
Hi,  
I am getting error while completing step 3rd (challenge).

Challenge Not yet complete... here's what's wrong:
The getBoats() method isn't working properly. Define getBoats() In the BoatSearchResults Apex controller to accept an optional boatTypeId and return all boats if no boatTypeId is passed, and a filtered list of boats if a boatTypeId is passed.

Has anybody encountered this error before? And how to tackle this?
Can someone please help me out here?

Thanks !
 
 I''m struck on Step 1 

User-added imageHere's my code ):
Can someone please help me out !

User-added image
Hi,
I passed this challenge. However, when I load the it, (through lightning page or an app) it gives an error- Action failed: c:BoatSearchResults$controller$doSearch [component is not defined]
In the code as well, there seems to be no reason to get this error. Below is my code.
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes" 
                access="global" controller="BoatSearchResults">
    <aura:handler name="init"  value="{!this}" action="{!c.doSearch}" /> 
	<aura:attribute name="boats" type="Boat__c[]" />

    <lightning:layout multipleRows="true" horizontalAlign="center">

    	    <aura:iteration items="{!v.boats}" var="boatVar">
                <lightning:layoutItem flexibility="grow"  class="slds-m-right_small" >   
                	<c:BoatTile boat="{!boatVar}"/>
                </lightning:layoutItem>
            </aura:iteration>
    		
               
            <aura:if isTrue="{!lessthan(v.boats.length,1)}">
                <lightning:layoutItem class="slds-align_absolute-center" flexibility="auto" padding="around-small">   
                    <ui:outputText value="No boats found" />
                </lightning:layoutItem>
            </aura:if>

    </lightning:layout>
</aura:component>
 
({
	doSearch: function(component, event, helper) {
        console.log('In do Search');
		helper.onSearch(component,event,helper);
	}
});
 
({
	onSearch : function(Component, event, helper) {
        console.log('In Helper');
		var action=component.get('c.getBoats');
        action.setCallback(this,function(response) {
            if(response.getState === 'SUCCESS')
            {
                var boatslist = response.getReturnValue();
                component.set("v.boats",boatslist);
            }
        });
        $A.enqueueAction(action);
	}
})
Below is the screenshot of the error message:
User-added image

Any hints, why it wouldn't load the app?

Thanks,
Manish
Challenge Not yet complete... here's what's wrong: 
The getBoats() method isn't working properly. Define getBoats() In the BoatSearchResults Apex controller to accept an optional boatTypeId and return all boats if no boatTypeId is passed, and a filtered list of boats if a boatTypeId is passed.

getting this error