We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Stretch all Grid Columns to Client Width

Hello. I am trying to determine the best method for sizing columns in a GridGroupingControl so that the columns stretch to fill the entire grid client area. I have found similar posts which stretch the final column in the collection only, but rather than expand/reduce the size of the final column only, I want each column (except for row headers, if they are visible) to expand and shrink as the grid is resized.

What is the best approach for accomplishing this?

4 Replies

AD Administrator Syncfusion Team August 25, 2006 12:24 PM UTC

I wanted to clarify this previous post.

I would like the column widths to resize proportionally (e.g. increase the size by 100 on a four-column grid, and each column expands its initial size by 25), as opposed to simply dividing the cilent size evenly among all grid columns.

Thanks for any help you can provide.

>Hello. I am trying to determine the best method for sizing columns in a GridGroupingControl so that the columns stretch to fill the entire grid client area. I have found similar posts which stretch the final column in the collection only, but rather than expand/reduce the size of the final column only, I want each column (except for row headers, if they are visible) to expand and shrink as the grid is resized.

What is the best approach for accomplishing this?


AD Administrator Syncfusion Team August 25, 2006 01:02 PM UTC

Hi John,

If you want all columns in the grid to grow and contract as you size the grid, you can do this in QueryColWidth event handler. Refer to the GridDataBoundImageCell sample in the browser samples that has some code that does this.

\Syncfusion\Essential Studio\4.1\Windows\Grid\Samples\DataBound\GridDataBoundImageCell

Regards,
Rajagopal


AD Administrator Syncfusion Team August 25, 2006 01:20 PM UTC

Hi Rajagopal,

Thanks for your response. I have one additional question regarding this issue.

When the QueryColWidth handler is invoked, what is the best way to determine if the row is a Plus/Minus expansion button? When I have hierarchical data defined, the Plus/Minus column is being resized as well, which I would prefer to avoid.

Is there a property that I can query, using the {e.Index} of the QueryColWidth argument that will tell me whether I am on a row which contains the Plus/Minus button versus a row which contains data?

Thanks for your help with this.

>Hi John,

If you want all columns in the grid to grow and contract as you size the grid, you can do this in QueryColWidth event handler. Refer to the GridDataBoundImageCell sample in the browser samples that has some code that does this.

\Syncfusion\Essential Studio\4.1\Windows\Grid\Samples\DataBound\GridDataBoundImageCell

Regards,
Rajagopal


AD Administrator Syncfusion Team August 25, 2006 01:50 PM UTC

Sorry. Read the last paragraph as:

Is there a property that I can query, using the {e.Index} of the QueryColWidth argument that will tell me whether I am on a column which contains the Plus/Minus button versus a column which contains data?


>Hi Rajagopal,

Thanks for your response. I have one additional question regarding this issue.

When the QueryColWidth handler is invoked, what is the best way to determine if the row is a Plus/Minus expansion button? When I have hierarchical data defined, the Plus/Minus column is being resized as well, which I would prefer to avoid.

Is there a property that I can query, using the {e.Index} of the QueryColWidth argument that will tell me whether I am on a row which contains the Plus/Minus button versus a row which contains data?

Thanks for your help with this.

>Hi John,

If you want all columns in the grid to grow and contract as you size the grid, you can do this in QueryColWidth event handler. Refer to the GridDataBoundImageCell sample in the browser samples that has some code that does this.

\Syncfusion\Essential Studio\4.1\Windows\Grid\Samples\DataBound\GridDataBoundImageCell

Regards,
Rajagopal

Loader.
Live Chat Icon For mobile
Up arrow icon