Skip to main content
added 135 characters in body
Source Link
glls
  • 20.3k
  • 19
  • 49
  • 83

The documentation states the following:

Resizing Tables and Columns

The width and height of the datatable is determined by the container element. A scroller is appended to the table body if there are more rows to display. For example, you can restrict the height to 300px by applying CSS styling to the container element.

So, if you set a specific width to the container element, then, my understanding is that the scroller should be appended automatically.

For example:

<div style="width: 300px;">
    <!-- lightning:datatable goes here -->
</div>

Tested and Works...

enter image description here

  <div class="container" style="width:250px">
        <lightning:datatable data="{! v.mydata }" 
            columns="{! v.mycolumns }" 
            keyField="id"
            onrowselection="{! c.getSelectedName }"/>
    </div>

The documentation states the following:

Resizing Tables and Columns

The width and height of the datatable is determined by the container element. A scroller is appended to the table body if there are more rows to display. For example, you can restrict the height to 300px by applying CSS styling to the container element.

So, if you set a specific width to the container element, then, my understanding is that the scroller should be appended automatically.

For example:

<div style="width: 300px;">
    <!-- lightning:datatable goes here -->
</div>

The documentation states the following:

Resizing Tables and Columns

The width and height of the datatable is determined by the container element. A scroller is appended to the table body if there are more rows to display. For example, you can restrict the height to 300px by applying CSS styling to the container element.

So, if you set a specific width to the container element, then, my understanding is that the scroller should be appended automatically.

For example:

<div style="width: 300px;">
    <!-- lightning:datatable goes here -->
</div>

Tested and Works...

enter image description here

  <div class="container" style="width:250px">
        <lightning:datatable data="{! v.mydata }" 
            columns="{! v.mycolumns }" 
            keyField="id"
            onrowselection="{! c.getSelectedName }"/>
    </div>
added 135 characters in body
Source Link
glls
  • 20.3k
  • 19
  • 49
  • 83

The documentationdocumentation states the following:

Resizing Tables and Columns

The width and height of the datatable is determined by the container element. A scroller is appended to the table body if there are more rows to display. For example, you can restrict the height to 300px by applying CSS styling to the container element.

So, if you set a specific width to the container element, then, my understanding is that the scroller should be appended automatically.

For example:

<div style="width: 300px;">
    <!-- lightning:datatable goes here -->
</div>

The documentation states the following:

Resizing Tables and Columns

The width and height of the datatable is determined by the container element. A scroller is appended to the table body if there are more rows to display. For example, you can restrict the height to 300px by applying CSS styling to the container element.

So, if you set a specific width to the container element, then, my understanding is that the scroller should be appended automatically.

For example:

<div style="width: 300px;">
    <!-- lightning:datatable goes here -->
</div>

The documentation states the following:

Resizing Tables and Columns

The width and height of the datatable is determined by the container element. A scroller is appended to the table body if there are more rows to display. For example, you can restrict the height to 300px by applying CSS styling to the container element.

So, if you set a specific width to the container element, then, my understanding is that the scroller should be appended automatically.

For example:

<div style="width: 300px;">
    <!-- lightning:datatable goes here -->
</div>
Source Link
glls
  • 20.3k
  • 19
  • 49
  • 83

The documentation states the following:

Resizing Tables and Columns

The width and height of the datatable is determined by the container element. A scroller is appended to the table body if there are more rows to display. For example, you can restrict the height to 300px by applying CSS styling to the container element.

So, if you set a specific width to the container element, then, my understanding is that the scroller should be appended automatically.

For example:

<div style="width: 300px;">
    <!-- lightning:datatable goes here -->
</div>