Wednesday, December 14, 2022

Lightning Datatable with fixed horizontal and vertical columns in Salesforce

.THIS .mydiv {
    max-width: 100em !important;
    max-height: 20em !important;
    overflow: scroll;
    position: relative;
  }
   
  .THIS table {
    position: relative;
    border-collapse: collapse;
  }
   
  .THIS td {
    padding: 0.25em;
  }
  .THIS th {
    padding: 0.25em;
  }
   
  .THIS thead th {
    position: -webkit-sticky !important; /* for Safari */
    position: sticky !important;
    top: 0;
    z-index: 1;
  }

  .THIS table thead th:first-child {
    position: sticky !important;
    left: 0;
    z-index: 2;
  }
  
  .THIS table tbody th {
    position: sticky !important;
    left: 0;
    background: white;
    z-index: 1;
  }

No comments:

Post a Comment

Understanding Wire vs Imperative Apex Method Calls in Salesforce Lightning Web Components (LWC)

Understanding Wire vs Imperative Apex Method Calls in Salesforce Lightning Web Components (LWC) Introduction: Salesforce Lightning Web ...