I have got list of records form a object and displaying. here i have created one lightning ui button(edit). on click of that button record should open. I have tried this. but it's not working.
My Component:
<aura:renderIf isTrue="{!idf.Final_Rating__c > 0 }">
<button onclick="{!c.editRecord}" class="slds-button slds-button_icon slds-cell-edit__button slds-m-left_x-small" tabindex="0" title="Edit Rating">
<lightning:icon iconName="utility:edit" size="xx-small" alternativeText="edit"/>
</button>
</aura:renderIf>
I have tried this: <button type="button" onclick="{!c.editRecord}" id="{!idf.Id}">Edit</button>
i am getting record Id. but edit in JS is not working.
My JS:
editRecord : function(component, event, helper) {
var editRecordEvent = $A.get("e.force:editRecord");
editRecordEvent.setParams({
"IdfId": component.get("v.recordId")
});
editRecordEvent.fire();
},
editmethod
on the click of the button, whereas you haveeditRecord
declared in the JS.ui:button
. Try testing with the minimum first and then extend it from ux perspective.