Guest User

Untitled

a guest
Apr 16th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. ({
  2. onSearch : function(component, event, helper) {
  3. // console.log('In Helper');
  4. var action=component.get('c.getBoats');
  5. var btypeId =component.get("v.boatTypeId");
  6. console.log('BoatSearchResult helper boattypeId '+btypeId);
  7. action.setParam({"boatTypeId" :btypeId});
  8. action.setCallback(this,function(response) {
  9. if(response.getState() === 'SUCCESS')
  10. {
  11. console.log('response from server'+ response.getReturnValue());
  12. var boatslist = response.getReturnValue();
  13. console.log('Number of Boats returned'+boatslist.length);
  14. component.set("v.boats",boatslist);
  15. }
  16. else
  17. {
  18. console.log('Error caught in !!!');
  19. }
  20. });
  21. $A.enqueueAction(action);
  22. }
  23.  
  24. public with sharing class BoatSearchResults {
  25.  
  26. @Auraenabled
  27. public static List<Boat__c> getBoats(string boatTypeId)
  28. {
  29. if(boatTypeId != '')
  30. {
  31. system.debug(boatTypeId);
  32. system.debug('Hello again');
  33. return ([Select Id, BoatType__c , Contact__r.Name, Name, picture__c from Boat__c Where BoatType__c = :boatTypeId]);
  34. // return ([SELECT Id, BoatType__c, picture__c, Name,contact__r.Name from Boat__c]);
  35. }
  36. else
  37. {
  38. system.debug('Hello again2');
  39. return ([SELECT Id, BoatType__c, picture__c, Name,contact__r.Name from Boat__c]);
  40.  
  41. }
  42. }
Add Comment
Please, Sign In to add comment