0

html:

<lightning-datatable
    data={addressData}
    columns={columns}
    onsave={handleSave}
    key-field="id"></lightning-datatable>

Js:

handleSave(event){
      let addressDraftValues = event.detail.draftValues;
        const UpdatedAddressData = {
            "UpdatedAddressData": addressDraftValues
        };
        dispatchOmniEvent(this, UpdatedAddressData, 'omniactionbtn');
}
  1. After editing fields in the table, on click of Save button(standard), the new edited value should be as is and the Save button should get hidden. I have custom save functionality in dispatchOmniEvent(), which is handled by the Vlocity. So just need to hide the save button after click.

  2. Also, If save button is hidden, how to get updated values from table?

enter image description here

0

Use the external CSS and include it into the static resource to hide the standard button by importing that static resource into your LWC component.

Thanks!!

| improve this answer | |
  • can you please share sample code. And how to retrieve updated values? – Ajinkyasd Apr 6 at 8:42
  • I have user something like this tho change to look and feel of the standard component: .slds-form-element_stacked.slds-form-element{ display:flex; } .slds-form-element__control.slds-grow{ width:auto; flex-basis: auto; } .slds-checkbox.slds-checkbox_standalone{ padding-top: 0.25rem; } – Suyash Apr 6 at 8:46
0

There are a couple of ways to achieve this in Javascript

Approch 1:

  • Suppress the Bottom Bar using suppressBottomBaron the html component
  • Implement oncellchange to display show/cancel in HTML
  • Implement onsave and cancel methods in js and control the behaviour

Approach 2:

  • If the data would be refreshed real-time. The data table can be refreshed using refreshApex

.JS

import { refreshApex } from '@salesforce/apex';
 handleSave(event){
  let addressDraftValues = event.detail.draftValues;
    const UpdatedAddressData = {
        "UpdatedAddressData": addressDraftValues
    };
    dispatchOmniEvent(this, UpdatedAddressData, 'omniactionbtn');
    refreshApex(this.retrieveData()); // INCLUDE THE METHOD THAT RETRIEVES THE DATA
  }
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.