0

I am trying to make my header sticky with overriding css with "Top:0" it seems to be over written by something else. I did try !Important but nothing seems to help.

2
  • Please provide enough code so others can better understand or reproduce the problem. Commented Sep 21, 2022 at 16:11
  • By what is it being overwritten if you look at the header using DevTools? Commented Sep 21, 2022 at 17:38

2 Answers 2

0

slds-table--header-fixed_container : add this class on div by specifying the height for div

slds-table--header-fixed : add this class to table

slds-cell-fixed: add this class to tag.

Sign up to request clarification or add additional context in comments.

2 Comments

Hi Santosh, Thank you so much for your answer. I checked that my div already has slds-table--header-fixed_container : And My table already has slds-table--header-fixed How do I add slds-cell-fixed to class tag ? I have a css file in static resources to override existing CSS. I am new to SF front end. I would really appreciate your help
The Div of cell already has the slds-cell-fixed: class . I am using chrome dev tool to see what else could be over writing it. But I don't see anything else.
-1

Please try like this. It works.

<template>
    <div style="height: 300px;">
        <lightning-datatable
                key-field="id"
                data={data}
                columns={columns}>
        </lightning-datatable>
    </div>    
</template>

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.