0

I am using a tree grid and in the column properties I have a column with the type: 'action' which renders a dropdown list with the list of typeAttributes I've specified. The issue I'm encountering is I cannot seem to adjust the column width for that specific column. I've tried setting the initialWidth: 250 and I've also tried setting min-column-width="250" attribute on the lightning-tree-grid. These attributes apply to the other columns, but not to the column of the dropdown.

Tree Grid:

            <div class="slds-p-around_medium lgc-bg">
                <lightning-tree-grid
                    columns={gridColumns}
                    data={data}
                    key-field="id"
                    onrowaction={handleRowAction}
                    min-column-width="250"
                ></lightning-tree-grid>

JS

get gridColumns() { 
    return [
        { 
            type: 'text',
            label: 'Product Name', 
            fieldName: 'productName', 
            initialWidth: 250 
        
        },
        {
            label: "Status", 
            fieldName: "status", 
            initialWidth: 250,
            type: "action",
            typeAttributes: { rowActions: [
                                                { name: "live", label: "Live" },
                                                { name: "inprogress", label: "In Progress" },
                                                { name: "contracted", label: "Contracted" },
                                            ]}
        },
    ];
}

The column looks like this when it renders:

enter image description here

1 Answer 1

1

The "action" type is always minimum width. It is used to present actions that a user can take for the row, such as editing or deleting a record. Ordinarily, no label is provided for this column type.

For example, this is how it might look when looking at a list of fields (highlighting added):

enter image description here

2
  • Thanks @sfdcfox that makes sense. As an alternative, would it be possible to set the row color based on the selection of the dropdown using onrowaction? For example, live is green, in progress is yellow and contracted is red. Could the individual row colors be manipulated? Feb 12 at 16:00
  • @user1718612 You can't highlight the entire row (e.g. a background), but you can add an iconName in cellAttributes to display an icon from the standard library.
    – sfdcfox
    Feb 12 at 19:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .