daily pastebin goal
16%
SHARE
TWEET

Untitled

a guest Mar 19th, 2019 41 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!-- Imports -->
  2.  
  3. <!-- handlers-->
  4. <aura:handler name="init" value="{! this }" action="{! c.init }"/>
  5.  
  6. <div class="slds-p-around_medium">
  7.     <h1 class="slds-text-heading_large">Inline edit playground</h1>
  8. </div>
  9.  
  10. <!-- the container element determine the height of the datatable -->
  11. <div style="height: 300px">
  12.     <lightning:datatable
  13.         columns="{! v.columns }"
  14.         data="{! v.data }"
  15.         keyField="id"
  16.         errors="{! v.errors }"
  17.         draftValues="{! v.draftValues }"
  18.         onsave="{! c.handleSaveEdition }"
  19.         onrowselection="{!c.getSelectedAccName}"
  20.     />
  21. </div>
  22.      
  23. getSelectedAccName: function (cmp, event) {
  24.     var selectedAccRows = event.getParam('selectedRows');
  25.     for (var i = 0; i < selectedAccRows.length; i++){
  26.         console.log(selectedAccRows[i].accountName+" is selected");
  27.     }
  28. },
  29.  
  30. handleSaveEdition: function (cmp, event, helper) {
  31.     var draftValues = event.getParam('draftValues');
  32.     helper.saveEdition(cmp, draftValues);
  33. },
  34.      
  35. // original values
  36.     var originalData = cmp.get("v.data");
  37.     console.log(originalData);
  38.  
  39.     // Question - how to save draftData in originalData
  40. },
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top