Created
February 20, 2019 19:19
-
-
Save choudharymanish8585/9383bcf955950b9d66698d093f5aa3f6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
({ | |
onSearch : function(component, helper) { | |
/*helper.callServer(component, "c.getCars", | |
function(response){ | |
//console.log("response---"+JSON.stringify(response)); | |
if(response.length >0 ){ | |
component.set("v.cars", response); | |
component.set("v.carFound", true); | |
} | |
},{ | |
carTypeId : component.get("v.carTypeId") | |
});*/ | |
/* | |
* Below code is used to call server side controller without inheritance | |
* however above code is perfect example to use inheritance | |
* and is working the same way as below function */ | |
var action = component.get("c.getCars"); | |
action.setParams( | |
{ | |
carTypeId : component.get("v.carTypeId") | |
} | |
); | |
action.setCallback(this, function(response) { | |
var state = response.getState(); | |
if (state === "SUCCESS") { | |
component.set("v.cars", response.getReturnValue()); | |
component.set("v.carFound", true); | |
} | |
}); | |
$A.enqueueAction(action); | |
}, | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment