Dashtable appears very shrunk when no output data

I have the code as shown above in the section defining my dashtable. I tried a bunch of things to ensure my output is an empty table with proper sized column widths when there is no data to be outputted - thus it should show no rows and an empty table with just headers.

However, it comes up as:

I am unable to solve this as the table appears to be very shrunk and ugly.

Is there something I can change to increase column width when no data matches input filters?

You should add code instead of Image, and please give us sample data to try to run too. And I have a question that minWidth in your style_cell not worked?


I agree with @hoatran . You can add code like this:



Yeah I agree - the reason I did not add code is because the data I use is very specific and would take really long to generate sample data.

The minWidth does not work when I uncomment it.

Hello @dgudhka,

What happens when you take out the fixed rows?

That fixes it - but I also need the fixed rows because sometimes I have 4000 rows and need the headers to show at all times

There are a couple of ways to fix this:
1 - you can apply css to fix this: Disappearing DataTable with fixed_rows - #2 by jinnyzor
2 - you could look into using AG Grid, this by default has fixed headers and scrolling enabled. :slight_smile:

1 Like

Can I just have the css code in the same script?

I prefer to have it all in one file.

This addition did not yield the fixed headers as I expected.

No, you cannot have the css in the same file.

It is very easy to add the css, just pop it into a css file under the assets folder in the same directory.

But, if you don’t want to mess with the css, then I suggest you used AG grid.