我对 Salesforce 照明应用程序开发非常陌生。在闪电应用程序中创建功能时,我正在寻求您的帮助。我已将所有帐户加载到闪电组件中,我需要通过单击 Billing City 名称使用 BillingCity 过滤记录。单击计费城市后,应显示与该城市相关的所有帐户,并且可以通过单击清除过滤器图像(这里我使用黑色圆圈)来清除过滤器,该图像会加载除特定条件之外的所有记录。
请帮忙 !!!
闪电应用主页
AccountMainScreen.cmp
<aura:component controller="AccountController">
<aura:attribute name="allaccounts" type="List" description="All Products" />
<aura:handler name="init" value="{!this}" action="{!c.fillAccount}"/>
<div class="container">
<div style="font-weight: bold;">Filter by Billing City</div><br/>
<div>Bangalore</div><br/>
<div>Mountain View</div><br/>
<div>Singapore</div><br/>
<div>
<div style="background-color: #7f7e8a;height: 20px;"></div>
<aura:iteration items="{!v.allaccounts}" var="account">
<article class="slds-card">
<div class="slds-card__header slds-grid">
<header class="slds-media slds-media--center slds-has-flexi-truncate">
<div class="slds-media__body slds-truncate">
<h2>
<a href="javascript:void(0);" class="slds-text-link--reset">
<span class="slds-text-heading--small">{!account.Name}</span>
</a>
</h2>
</div>
</header>
</div>
<div class="slds-card__body">{!account.BillingCity}</div>
</article>
</aura:iteration>
</div>
</div>
</aura:component>
AccountController.apxc
public class AccountController {
@AuraEnabled
public static List<Account> getAllAccounts()
{
List<Account> lstacc=[select Name,BillingCity from Account where BillingCity != null];
return lstacc;
}
}
AccountMainScreenController.js
({ fillAccount : function(component, event, helper) {
helper.getAccountsfromSF(component, event) } })
AccountMainScreenHelper.js
({
getAccountsfromSF : function(component, event) {
var action = component.get('c.getAllAccounts');
action.setCallback(this,function(actionResult){
component.set('v.allaccounts', actionResult.getReturnValue());
});
$A.enqueueAction(action);
}
})