You need to sign in to do that
Don't have an account?

Selector Pattern in Lightning Component
Hi All,
I have implemented a search button click function to retrieve and fetch data into table in lightning component.
and its working fine. Now I want to do the same thing using selector pattern.I want to change the code using selector pattern. Can anyone please help me to implement this.
Thank you.
I have implemented a search button click function to retrieve and fetch data into table in lightning component.
@AuraEnabled public static List < Data_Import__c > fetchdata(String statuskey,String versionkey) { String status = statuskey; String version = versionkey; List <Data_Import__c> returnList = new List <Data_Import__c>(); for (Data_Import__c dataim: [SELECT Name,Error_message__c,version__c,Status__c FROM Data_Import__c WHERE Status__c =: status AND version__c =: version]) { returnList.add(dataim); } return returnList; }
Search: function(component, event, helper) { helper.SearchHelper(component, event); } SearchHelper: function(component, event) { var action = component.get("c.fetchdata"); action.setParams({ 'statuskey': component.find("statusId").get("v.value"), 'versionkey': component.find("versionId").get("v.value") });
and its working fine. Now I want to do the same thing using selector pattern.I want to change the code using selector pattern. Can anyone please help me to implement this.
Thank you.
Yes. Call the selector methods inside fetchData(). The returnList should return list < Data_Import__c > data.