+ Start a Discussion
Gbolahan JolapamoGbolahan Jolapamo 

Lightening Component for custom apex class

Hi all,

My team and I came up with a simple custom UI build of a seach bar and a visual force page for it. we want to develop a lightening component and make the search bar class methods aura enabled. Can any one assist with the design of the lightning component.


Public class searchbar{  
string keyword;
List<account>acts;
@AuraEnabled
Public string getkeyword(){
return keyword; }
@AuraEnabled
Public List<account> getacts(){
return acts; }  
Public void setkeyword(string s){
eyword = s;
}
 Public Pagereference search_now(){
acts= (List<account>) [Find :keyword IN ALL FIELDS RETURNING Account(name, type, industry, phone, fax)][0]; return null;
}  
}    

VF Page markup:

<apex:page CONTROLLER="searchbar" sidebar="false" showHeader="false">
<apex:form > <apex:inputText value="{!keyword}"/> <apex:commandButton value="Search" action="{!search_now}"/>
<apex:pageBlock >
<apex:pageblockTable value="{!acts}" var="a">
<apex:column value="{!a.Name}"/>
<apex:column value="{!a.Type}"/>
<apex:column value="{!a.Industry}"/>
<apex:column value="{!a.Phone}"/>
<apex:column value="{!a.Fax}"/>
</apex:pageblockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
 
sfdcMonkey.comsfdcMonkey.com
hi Gbolahan Jolapamo
go to below link for create account search lightning component
https://teachforce.wordpress.com/2016/12/15/search-accounts-lightning-component/

let me infrom if you have any issue with it and mark it best answer if my answer helps you
thanks
Gbolahan JolapamoGbolahan Jolapamo
Hi everyone, still on search.
 i am writing an apex class to return a list of data on a visualforce page table. Can anyone help with the code as it return errors

\*ForceAwakens__isActive__c is a checkbox on the ForceAwakens__Price_Matrix__c object. I want to display the records from a ForceAwakens__Matrix_Data__c when the input from another object, that is, ForceAwakens__Price_Matrix__c is supplied at the ui. 
/*
Here is my code,

public class searchController{

List<ForceAwakens__Price_Matrix__c>  matrix =  new List<ForceAwakens__Price_Matrix__c>();
public static List<ForceAwakens__Matrix_Data__c> getMatrixData(ForceAwakens__Price_Matrix__c name){
if (matrix.ForceAwakens__isActive__c == true){
ForceAwakens__Matrix_Data__c data = [select ForceAwakens__Input_Data__c, ForceAwakens__Output_Data__c from ForceAwakens__Matrix_Data__c where ForceAwakens__Price_Matrix__c =: name];
return data;
}else{return null;}
  } 
}