function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
lightning demo 22lightning demo 22 

Unable to display account object Details in lightning component

I am using a datatable to display account related info.
Here's my code.
Base.cmp

<aura:component abstract="true">
    {!v.body}
</aura:component>


BaseHelper.js

({
    callServer : function(component,method,callback,params) {
        var action = component.get(method);
        if (params) {
            action.setParams(params);
        }
        
        action.setCallback(this,function(response) {
            var state = response.getState();
            if (state === "SUCCESS") { 
                // pass returned value to callback function
                callback.call(this,response.getReturnValue());   
            } else if (state === "ERROR") {
                // generic error handler
                var errors = response.getError();
                if (errors) {
                    console.log("Errors", errors);
                    if (errors[0] && errors[0].message) {
                        throw new Error("Error" + errors[0].message);
                    }
                } else {
                    throw new Error("Unknown Error");
                }
            }
        });
        
        $A.enqueueAction(action);
    }
})

SearchAccount.cmp

<aura:component implements="flexipage:availableForAllPageTypes,
                            force:appHostable"
                extends="c:Base"
                controller="AccountSearch"
                access="global">
    
     <!--I need an attribute-->
     <aura:attribute name="searchKeyWord"
                     type="String"
                     access="global"/>
      
    <!--I also need an attribute which will have list of accounts to display-->
    <aura:attribute name="accounts"
                     type="Account[]"
                     access="global"/>
     
	<div class="slds-m-around_medium">
    <lightning:card title="Enter The Account Name To Search">
       <!--I need an lightning input text to search-->
    <lightning:input name="search" 
                     value="{!v.searchKeyWord}"
                     aura:id="searchKey"
                     type="String"/>
        
     <lightning:button variant="base"
                      label="Search" 
                      onclick="{!c.fetchAccounts}"
                      iconName="utility:search"/>
    </lightning:card>
    
    
    <!-- I need to display the datatable to show and have values in the fields-->
    <table class="slds-table slds-table--bordered slds-table--cell-buffer">
        <thead>
            <tr class="slds-text-title--caps">
                <th scope="col">
                    <div class="slds-truncate" title="AccountName">Name</div>
                </th>
                <th scope="col">
                    <div class="slds-truncate" title="Phone">Phone</div>
                </th>
                
                <th scope="col">
                    <div class="slds-truncate" title="Rating">Rating</div>
                </th>
            </tr>
        </thead>
        
        <!--table body start, 
        Iterate contact list as a <tr> 
        -->
        <tbody>
            <aura:iteration items="{!v.accounts}" 
                            var="acc">
                <tr>
                    <th scope="row">
                        <div class="slds-truncate" title="{!acc.Name}">{!acc.Name}</div>
                    </th>
                    <th scope="row">
                        <div class="slds-truncate" title="{!acc.Phone}">{!acc.Phone}</div>
                    </th>
                    <th scope="row">
                        <div class="slds-truncate" title="{!acc.Rating}">{!acc.Rating}</div>
                    </th>
                  
                </tr>
            </aura:iteration>
            
        </tbody>
        
    </table>
    </div>
  </aura:component>


SearchAccountController.js

({
    fetchAccounts : function(component,event,helper) {
        helper.queryAccounts(component,helper,'');
     
   }
})


SearchAccountHelper.js

({
    queryAccounts : function(component,helper,searchkeyword)
    {
         helper.callServer(
            component,
            "c.getAccounts",
            function(response) 
            {  
                component.set('v.accounts', response);
            }, 
            {   
                Keyword : searchkeyword
            }
        );
    }
    
})

The issue is when enter the account name and click search Button I do not see any data 

Please let me know where I am going wrong.

OLIVA