【发布时间】:2022-01-04 15:40:55
【问题描述】:
我是 Salesforce 新手,需要您的指导。
我正在创建闪电组件,如下所示。
对于这个闪电组件,我正在实现:force:lightningQuickAction。
还有一个按钮:“选择产品项目”
按下按钮时,我想调用另一个组件作为弹出窗口,就像上图一样。 但这是我得到的:
这是我的代码: 组件 1:cmp:
<aura:component controller="OptyProductItemController" implements="flexipage:availableForAllPageTypes,force:hasRecordId,force:lightningQuickAction" access="global" >
// Removed code here
<lightning:button variant="Brand" class="slds-m-top_small" type="submit" label="Create SO" />
<lightning:button variant="Neutral" class="slds-m-top_small" label="Select Product Item" onclick="{! c.pickProductItem }" />
</aura:component>
组件 1:控制器
pickProductItem : function(component, event, helper) {
var navigateEvent = $A.get("e.force:navigateToComponent");
navigateEvent.setParams({
componentDef: "c:SelectSalesOrderItem",
componentAttributes: {
optyId : component.get("v.recordId")
}
//componentAttributes :{ }
});
navigateEvent.fire();
}
组件 2:cmp
<aura:component controller="SelectSalesOrderItemController" implements="flexipage:availableForAllPageTypes,force:hasRecordId,force:lightningQuickAction" access="global">
<aura:attribute name="mycolumn" type="Object[]"/>
<aura:attribute name="optyId" type="String"/>
<aura:attribute type="Opportunity_Product_Item__c[]" name="optyProductList"/>
<aura:handler name="init" value="{!this}" action="{!c.fetchOptyProduct}"/>
<lightning:datatable data="{!v.optyProductList }"
columns="{!v.mycolumn}"
keyField="id"
hideCheckboxColumn="false" />
</aura:component>
我的代码有错误吗?
【问题讨论】:
标签: salesforce salesforce-lightning