Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ({
- onSearch : function(component, event, helper) {
- // console.log('In Helper');
- var action=component.get('c.getBoats');
- var btypeId =component.get("v.boatTypeId");
- console.log('BoatSearchResult helper boattypeId '+btypeId);
- action.setParam({"boatTypeId" :btypeId});
- action.setCallback(this,function(response) {
- if(response.getState() === 'SUCCESS')
- {
- console.log('response from server'+ response.getReturnValue());
- var boatslist = response.getReturnValue();
- console.log('Number of Boats returned'+boatslist.length);
- component.set("v.boats",boatslist);
- }
- else
- {
- console.log('Error caught in !!!');
- }
- });
- $A.enqueueAction(action);
- }
- public with sharing class BoatSearchResults {
- @Auraenabled
- public static List<Boat__c> getBoats(string boatTypeId)
- {
- if(boatTypeId != '')
- {
- system.debug(boatTypeId);
- system.debug('Hello again');
- return ([Select Id, BoatType__c , Contact__r.Name, Name, picture__c from Boat__c Where BoatType__c = :boatTypeId]);
- // return ([SELECT Id, BoatType__c, picture__c, Name,contact__r.Name from Boat__c]);
- }
- else
- {
- system.debug('Hello again2');
- return ([SELECT Id, BoatType__c, picture__c, Name,contact__r.Name from Boat__c]);
- }
- }
Add Comment
Please, Sign In to add comment