2

I am wondering if I have found a minor bug with LWCs. I have noticed that row numbers in a data table are turned on if one of the columns is set to "Editable" even if the "show-row-number-column" isn't present.

I have created a simple playground (linked below) to illustrate this potential bug. Note, that "show-row-number-column" isn't on the data table yet the row numbers are displayed. As soon as you set all of the columns to editable:false the row number will go away.

This may be the expected behavior, but I couldn't find it documented anywhere. Of course, this isn't a big deal at all, but for my specific use case, it does make it a little confusing for the end-user.

 <!-- Note how "show-row-number-column" isn't selected 
    yet the row numbers are still dislayed -->
    <lightning-datatable
            key-field="id"
            data={data}
            columns={columns}>
    </lightning-datatable>

https://developer.salesforce.com/docs/component-library/tools/playground/qRYnNX2ci/6/edit

2

This is an expected behavior and is documented:

By making a column editable, the show-row-number-column attribute is always true and the number column is displayed.

1
  • Thanks, I definitely didn't recall that line in the error section. It does make sense that the row numbers are required since the errors reference the numbers. – Tim Wilson Oct 7 '19 at 19:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.