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.
Unfortunately, activation email could not send to your email. Please try again.

Vertical Header Width of Column

Thread ID:

Created:

Updated:

Platform:

Replies:

128617 Feb 1,2017 07:32 AM Feb 16,2017 07:13 AM ASP.NET MVC 5
loading
Tags: Grid
indrani Gajjarapu
Asked On February 1, 2017 07:32 AM

Hi,

I attached a script and the grid image with vertical headers.

I want to set the width of each column according to the cell content.

Can you give me a workaround for this please.

Thank you


Mani Sankar Durai [Syncfusion]
Replied On February 2, 2017 06:13 AM

Hi Indrani, 

Thanks for contacting Syncfusion support. 

We have analyzed your query and we suggest you to enable AllowResizeToFit property which helps to set the column width inbuilt based on its cell content. So it is not necessary to set the width for the columns explicitly.  
Refer the below code example. 
[GridFeatures.cshtml] 
@(Html.EJ().Grid<MvcApplication14.OrdersView>("FlatGrid") 
                                    .Datasource((IEnumerable<object>)ViewBag.dataSource) 
                            .AllowPaging() 
                             .AllowResizeToFit()       //set the column width based on its content 
                          .Columns(col => 
        { 
                           ... 
        }) 
    ) 

Also you have mentioned that you are using like vertical headers. 

So please refer the following KB and documentation link. 

If you face any difficulties please share the following details, 
1.       Share the screenshot/video of the issue you have faced. 
2.       Share the full grid code. 
3.       Share the sample with issue reproducing. 
The provided information will help us to analyze the issue and provide you the response as early as possible. 

Please let us know if you need further assistance. 

Regards, 
Manisankar Durai 


indrani Gajjarapu
Replied On February 6, 2017 06:41 AM

Hi,

Thanks for your reply.

"AllowResizetoFit" works to some extent. However as mentioned in the documentation, the column width is set automatically based on content or header text text which is large. But my requirement is to set width only by content but not header text.

Please find the picture attached as an example.

Regards,

Indrani


Attachment: pic_3d60cb34.zip

Prasanna Kumar Viswanathan [Syncfusion]
Replied On February 7, 2017 01:12 PM

Hi Indrani, 

If you need to set column width based on content only, enable the AllowTextWrap property and wrapMode as header in textWrapSettings API of ejGrid. The allowTextWrap  property is used to wrap the content to the next line if the content exceeds the column. In this when we set the wrapMode as header then the auto wrap will be set only for header. 

Find the code example:  

@(Html.EJ().Grid<Document>("HierarchyGrid") 
   .Datasource((IEnumerable<object>)ViewBag.datasource) 
   .AllowSorting() 
   .AllowPaging() 
   .AllowResizeToFit() 
   .AllowTextWrap() 
   .TextWrapSettings(e => e.WrapMode(WrapMode.Header)) 
   .IsResponsive() 
   .Columns(col => 
    { 
        -------------------- 
) 

Refer to the Help document. 



Regards, 
Prasanna Kumar N.S.V

indrani Gajjarapu
Replied On February 15, 2017 09:13 AM

Hi Prasanna Kumar,

Thanks for your reply.

I did apply those settings but they didn't completely solve the issue.

I have attached a sample project below.

Thank you.

Regards,
Indrani

Attachment: ColumnWidth_d2ea486b.7z

Mani Sankar Durai [Syncfusion]
Replied On February 16, 2017 07:13 AM

Hi Indrani, 
 
A support incident has been created under your account to track the status of this requirement. Please log on to our support website to check for further updates.  
 

Regards, 
Manisankar Durai. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;