[英]How to reload RecordViewForm in Salesforce lightning component?
我正在使用閃電:recordViewForm 從 salesorce 中的自定義對象加載某些記錄,這是第一次通過此表單標簽填充值,但我想刷新(重新加載)此表單以填充最新的數據庫更改。請參閱代碼片段:
<aura:iteration items="{!v.orderWrapperList}" var="obj">
<!-- Display details of order -->
<lightning:card title="{!obj.Name}" iconName="standard:scan_card">
<lightning:recordViewForm aura:id="forceRecord" recordId="{!obj.Id}" objectApiName="Order__c">
<div class="slds-box slds-theme_default">
<lightning:outputField fieldName="Total_Amount__c" />
<lightning:outputField fieldName="Score__c" />
<lightning:outputField fieldName="Status__c" />
</div>
</lightning:recordViewForm>
<div align="center" draggable="false" >
<lightning:button variant="brand" label="Cancel" onclick="{! c.reDirect }" />
<lightning:button variant="brand" label="Submit" onclick="{! c.openModel }" />
</div>
</lightning:card>
</aura:iteration>
refresh : function(component, event, helper) {
var action = cmp.get('c.myController');
action.setCallback(cmp,
function(response) {
var state = response.getState();
if (state === 'SUCCESS'){
$A.get('e.force:refreshView').fire();
} else {
//do something
}
}
);
$A.enqueueAction(action);
}
要刷新視圖,請運行 $A.get("e.force:refreshView").fire();,它會重新加載視圖的所有數據。
更多信息: https ://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/ref_force_refreshView.htm
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.