Skip to content

Instantly share code, notes, and snippets.

@loktevich
Created May 7, 2020 16:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loktevich/1cd135d1d7a0f7862724a7df920cd786 to your computer and use it in GitHub Desktop.
Save loktevich/1cd135d1d7a0f7862724a7df920cd786 to your computer and use it in GitHub Desktop.
LWC. Possible way to remove header action buttons from lightning-datatable
// Rendered callback adds style element that hides standard action buttons
renderedCallback() {
if (!this.hasRendered) {
const style = document.createElement("style");
style.innerText =
"c-my-component lightning-datatable .slds-th__action-button {display: none;}";
this.template
.querySelector("lightning-datatable")
.appendChild(style);
this.hasRendered = true;
}
}
@loktevich
Copy link
Author

For advanced styling you can use this approach to load entire CSS file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment