7 个回答
Here are my client side controller and helper:HELPER***********************({ getLocalList : function(component) { //var searchTerm = component.get("v.defaultSearch"); var recId = component.get("v.recordId"); var location = component.get("v.location"); //var action = component.get("c.getLocal"); var searchTerm = component.find("searchTerm").get("v.value"); if(searchTerm == null){ searchTerm = component.get("v.defaultSearch"); } location = JSON.parse(location); var action = component.get("c.getListByAddress"); action.setParams({ "recordId" : recId, "searchQuery" : searchTerm }); action.setCallback(this, function(response){ this.doLayout(response, component); }); $A.enqueueAction(action); }, doLayout: function(response, component){ var data = JSON.parse(response.getReturnValue()); component.set("v.restaurantList", data.bizArray); console.log("The data: ", data); }})CONTROLLER(Client side)***********************************({ doInit : function(component, event, helper) { helper.getLocalList(component); }, updateSearch : function(component, event, helper){ helper.getLocalList(component); }})