Skip to content

Instantly share code, notes, and snippets.

@choudharymanish8585
Created February 20, 2019 19:19
Show Gist options
  • Save choudharymanish8585/9383bcf955950b9d66698d093f5aa3f6 to your computer and use it in GitHub Desktop.
Save choudharymanish8585/9383bcf955950b9d66698d093f5aa3f6 to your computer and use it in GitHub Desktop.
({
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