Skip to main content

#Dropdown Selection0 discussing

# Solution: Making Row Action Dropdown Menu Extend Outside the Lightning Datatable 

 

## Problem 

 

When creating a custom datatable component using Lightning Web Components (LWC), I noticed that the row action dropdown menu (containing options like Edit, Delete, etc.) was confined within the table boundaries and wouldn't extend outside the table. This negatively impacted the user experience, especially with narrow tables. 

 

In standard Salesforce behavior, these dropdown menus extend outside the table and appear above other elements. However, this behavior wasn't occurring in my custom datatable component. 

 

## Root Cause 

 

The root cause of the issue was the `slds-table_fixed-layout` CSS class used in the datatable component. This class fixes the width of the table and controls the width of cells, but it also applies the `table-layout: fixed` CSS property. This property locks the table layout and prevents content from overflowing, which prevents the dropdown menu from extending outside the table. 

 

## Solution 

 

The solution is very simple: remove or replace the `slds-table_fixed-layout` class. 

 

```html 

<c-custom-datatable 

    key-field="Id" 

    data={itemsData} 

    columns={columns} 

    draft-values={draftValues} 

    onsave={handleSave} 

    onrowaction={handleRowAction} 

    class="slds-table_bordered" <!-- instead of slds-table_fixed-layout --> 

    hide-checkbox-column 

    wrap-text-max-lines="2" 

    wrap-table-header="all"> 

</c-custom-datatable> 

``` 

 

## Result 

 

This simple change allows the dropdown menu to extend outside the table and aligns with standard Salesforce behavior. I hope this solution helps other developers who encounter similar issues. 

 

#LWC  #Datatable  #Dropdown Selection

0/9000

Hi, I created a custom dropdown field in Pardot and mapped it to a Salesforce picklist field from the Lead object.  In the Pardot field definition, the list of values from the Salesforce picklist appears, but none are checked, and there's no Select All option. Only selected values appear on a Pardot form.  

How to get all the boxes checked in mass/quickly? (there are hundreds, and the Chrome extension doesn't work for this page).  Or did I do something incorrectly with the custom field setup?

I do have the checkbox "Keep this field's type and possible values in sync with CRM" checked.

0/9000

Hi,

Is there a way to check whether my dropdown selection is equal to all? 

2 comments
  1. Oct 1, 2018, 8:10 PM
    Example: on my drop down, I select all picklist options. This will give me all rows that aren't null. Compare this to the unfiltered result to see differences.
0/9000