0

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();
},
3
  • You seem to be calling editmethod on the click of the button, whereas you have editRecord declared in the JS.
    – Jayant Das
    May 8, 2018 at 12:49
  • actually i have added editmethod is used in JS and editRecord is helper..i have replaced them. in my code also May 8, 2018 at 12:55
  • So does it work now? Also does not seem like you are using ui:button. Try testing with the minimum first and then extend it from ux perspective.
    – Jayant Das
    May 8, 2018 at 13:00

1 Answer 1

1

Your component have a problem use below line in component

 <aura:renderIf isTrue="{!idf.Final_Rating__c > 0 }">
   <lightning:buttonIcon iconName="utility:edit" 
                        class="slds-col_bump-left" 
                        variant="bare" 
                        alternativeText="Edit Record"
                        onclick="{!c.editRecord}" />
 </aura:renderIf>
4
  • No bro..even this not helping me. May 8, 2018 at 13:18
  • put your complete code and whats error you are getting. please share in details so i can or other can help on your query May 8, 2018 at 13:30
  • I have tried like this <button type="button" onclick="{!c.editRecord}" id="{!idf.Id}">Edit</button> here i am getting record id. but edit mode of record is not working May 8, 2018 at 14:24
  • @SFDCDeveloper Please do not call people "bro" on this site. It isn't a very polite form of address.
    – Adrian Larson
    May 8, 2018 at 14:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .