Skip to main content
It is great that Lightning:datatable has built in SAVE/CANCEL button functionality.  I also understand that you can add SAVE button to each row.

The user wants to have an additional SAVE button at the top of the screen, as well as at the bottom.  Is this possible?  I defined a button as follows and linked it to a new onclick action that replicates the other save behavior.

 

<!--<div class="slds-float-right">

<lightning:button label="Save" variant="brand" onclick="{! c.handleTopSaveEdition}"/>

</div>

The button is displayed, but nothing happens when clicked.  What am I missing?

 
1 risposta
  1. 7 mag 2019, 15:41

    //FWIW, here is my controller code:

    //Called from the MAIN Save button

    handleSaveEdition: function (cmp, event, helper) {

    var updatedValues = event.getParam('draftValues');

    helper.saveDataTable(cmp, updatedValues);

    },

    //Called from the Custom Save button (at top)

    handleTopSaveEdition: function (cmp, event, helper) {

    var updatedValues = event.getParam('draftValues');

    helper.saveDataTable(cmp, updatedValues);

    },