【问题标题】:Display Project records on click of input filed单击输入字段时显示项目记录
【发布时间】:2021-06-21 12:35:28
【问题描述】:

我是光环组件的新手。我有要显示项目记录的字段。On click of field I should get project records 期望输出On click of input field , I should get records like this 谁能帮帮我

    **Component :** 


    <aura:component >
          <div class="slds-align_absolute-center">
       <lightning:layoutItem size="4">
         <table> <tr><td style="padding:20px;">
             <lightning:input type="sObject" aura:id="test" name="Project" label="Project" value="" placeholder="search project" onClick="{!c.handleClick}"/>
             </td></tr>
             </table>
             </lightning:layoutItem>
            </div> 
    </aura:component>
    
    **Controller :**
    public class ListOfProjects {
        @AuraEnabled
        public  static List<project__c> getProjectList() {
            List<project__c> myProjects = [SELECT Name from project__c ];
            return myProjects;
        }
    }
    
    **.Js file :** 
    ({
        handleClick : function(component, event, helper) {
            var action = component.get("c.getProjectList");
            action.setCallback(this, function(response) {
               console.log(response.getReturnValue());
                component.set("v.Projects" ,response.getReturnValue());
            });
            $A.enqueueAction(action);
        }
    })


[Required output][1]


  [1]: https://i.stack.imgur.com/DQhXw.jpg

【问题讨论】:

    标签: salesforce apex apex-code salesforce-lightning


    【解决方案1】:
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-03-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-29
    • 2020-05-10
    • 1970-01-01
    相关资源
    最近更新 更多