Hide DataGrid Expand Column

Is there anyway to hide the column that appears (with the arrow, indicating whether it's expanded or not) when I add an expand template?

My intentions are when my user clicks on the row, I trigger the ExpandRow method in code, so I don't want the column. Is there a way to not render this column or do I have to do it with CSS?

When I use CSS to hide the column, it seems to disable the ability to expand a row. I can provide actual code if needed.

Hi @beeterry,

This is not supported. The expand collapse column is always rendered when the Template is set.

Bummer. Does this seem like an easy enough feature to request or is it more difficult than it seems? Something like a "ShowExpandIcon" property or something would be fantastic.

You can use IsExpandable similar to this demo:

Are you sure this would solve my problem? I want all of my rows to be expandable, but I don't want the arrow icon (first column) that gets rendered when that is enabled.

In this case you can tartare the expand icon with CSS, use your browser developer tools inspector to get the class name.

I must have done something wrong then because when I used CSS to hide that column, it seemed to disable my ability to expand/collapse the row in code. I'll confirm this and return with more detail if I can't get that to work.

Not sure what I was doing before that caused my issues, but setting display:none via CSS works perfectly. Thanks guys!

Just a heads up, setting things via CSS doesn't work because it messes up the size of the other columns. I am able to delete the column elements via JS, but then it messes up the colspan that gets assigned to the expand template when it expands. All of these things I can get around, but in a hacky manner.

Just saying this to make you aware that a flag on whether a user wants this expand column icon would be useful!

Hey @beeterry,

We are open source and we accept pull requests!

1 Like

Oh, I can't believe I didn't realize that. Thanks!