autosize GridButtonColumn with multiple cellbuttons

Hello,

is seems impossible to find a way to autosize the column width of a  GridButtonColumn hosting multiple cell buttons . for example:

List<CellButton> buttons = new List<CellButton>();

            buttons.Add(new CellButton() { Text = "Button1" });

            buttons.Add(new CellButton() { Text = "Button2" });

            buttons.Add(new CellButton() { Text = "Button3" });

            this.sfDataGrid.Columns.Add(new GridButtonColumn()

            {Buttons = buttons,AutoSizeColumnsMode= AutoSizeColumnsMode.AllCells});


it always trims the contents of each cell in a way that the user cannot see all the buttons unless he resize the column

any help on this matter?



7 Replies

DM Dhanasekar Mohanraj Syncfusion Team June 15, 2023 02:15 PM UTC

Hi Nnikos,

We have checked the reported scenario with the provided details. In that, our SfDataGrid’s AutoSizeColumnsMode does not support the GridButtonColumn. This is because the AutoSizeColumnsMode is updated the column widths based on the text content size, which is not applicable for button columns. However, you can overcome this by manually setting a static column width for the GridButtonColumn based on the desired width of the buttons as shown below,

List<CellButton> buttons = new List<CellButton>();

buttons.Add(new CellButton() { Text = "Button1"});

buttons.Add(new CellButton() { Text = "Button2" });

buttons.Add(new CellButton() { Text = "Button3" });

this.sfDataGrid1.Columns.Add(new GridButtonColumn()

{

    Buttons = buttons,

    Width = 150

});


By doing so, you can ensure that the buttons are displayed properly.

Regards,
Dhanasekar M.

If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.



NN nn June 15, 2023 03:16 PM UTC

well, this a quick and dirty approach. what if the text in cellButtons is dynamic? for example different text translation. this is not an acceptable solution. Do you plan to include a fix for this?

thank you




DM Dhanasekar Mohanraj Syncfusion Team June 16, 2023 01:41 PM UTC

Nnikos,

Currently, we are checking the feasibility to achieve your requirement. We will check and update you with further details on June 20, 2023.

We appreciate your patience until then.



DM Dhanasekar Mohanraj Syncfusion Team June 21, 2023 06:27 AM UTC

Nnikos,

We need more time to analyze the feasibility to achieve your requirement. We will check and update you with further details on June 22, 2023.

We appreciate your patience and understanding.



DM Dhanasekar Mohanraj Syncfusion Team June 22, 2023 02:23 PM UTC

Nnikos,

As we mentioned earlier, currently GridButtonColumn does not have the AutoSizeColumnsMode support. However, we have analyzed and considered your requirement of “Provide the AutoSizeColumnsMode support for the GridButtonColumn” and logged a feature request for the same. We will share further details tomorrow(June 23, 2023).




DM Dhanasekar Mohanraj Syncfusion Team June 23, 2023 06:47 AM UTC

Nnikos,

We have considered your requirement of “Provide the AutoSizeColumnsMode support for the GridButtonColumn” and logged a feature request for the same. We will implement this feature in our Essential Studio 2023 Volume 2 Service Pack Release which is scheduled for the mid of August 2023. We will let you know when this feature is implemented. We appreciate your patience until then.

You can track the status of this report through the following feedback link,

Feedback link: https://www.syncfusion.com/feedback/44720/provide-the-autosizecolumnsmode-support-for-the-gridbuttoncolumn

If you have any more specifications/suggestions for the feature request, you can add them as a comment in the portal and cast your vote to make it count.



CM Chidanand Murugaiah Syncfusion Team July 31, 2023 12:34 PM UTC

Hi Nnikos,

 

We are glad to announce that our Essential Studio 2023 Volume 2 Service Pack Release V22.2.5 is rolled out  with the reported bug fix "Provide the AutoSizeColumnsMode support for the GridButtonColumn" and is available for download under the following link.


Essential Studio 2023 Volume 2 Service Pack Release v22.2.5 is available for download | Announcements Forums | Syncfusion


We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.

 

Regards,

Chidanand M.


Loader.
Up arrow icon