Grid Grouping Control Set Column Width

Hi,
I' am using Grid Grouping Control to display data and having issue setting up column width. It looks like GGC auto-resets the column width. I have to use "MappingName" property to make use of search box.  I tried to use ItemTemplate and added a label to control the width. However, ItemTemplate caused issue while searching data using Search Box and couldn't find any match.

So, is there a way to dynamically set the column width?
otherwise, is there a way to search content using search box if I have to use template control?

Here is the code:

<Syncfusion:GridGroupingControl
    ID="GridGroupingControl1"
    EnableCallbacks="false" 
    ShowSearchBox="true"
    runat="server"                                  
    ShowGroupDropArea="true"
    DataMember="DefaultView"
    DataSourceCachingMode="ViewState"
    AutoFormat="Office 2007 Blue"
    BorderCollapse="Separate"                               
>
    <TableOptions ShowRowHeader="true"></TableOptions>                               
    <TableDescriptor
        AllowFilter="False" AllowNew="false"
        AllowRemove="true" AllowEdit="false"                                   
        >
        <Columns>                                   
        <syncfusion:GridColumnDescriptor
                Width="50" 
                Appearance-AnyCell-AutoSize="false"
                Appearance-AnyRecordFieldCell-AutoSize="false"
                Appearance-AnyRecordFieldCell-WrapText="true"
                Appearance-AnyRecordFieldCell-HorizontalAlignment="Left"                                           
                Appearance-AnyHeaderCell-AutoSize="false"
                AllowGroupByColumn="true"
                AllowSort="true"                                           
                MappingName="TestData1"
                HeaderText="Test Resources">                                           
            </syncfusion:GridColumnDescriptor>
            <syncfusion:GridColumnDescriptor
                Width="20"
                AllowGroupByColumn="true"
                Appearance-AnyRecordFieldCell-HorizontalAlignment="Left"                                           
                MappingName="TestActivity"
                HeaderText="Test Activity">
            </syncfusion:GridColumnDescriptor>
      </Columns>                                   
    </TableDescriptor>                               
</Syncfusion:GridGroupingControl>

Any help would be appreciated. Thanks!

5 Replies

TD TD June 15, 2012 05:13 PM UTC

I found a work-around. "Width" property doesn't work, so I had to use "CssClass" and used "max-width" property to resolve the issue. Well, it at least works on Firefox.


YO Yogeshwaran Syncfusion Team June 18, 2012 06:09 AM UTC

Hi Trushith,

 

Thanks for using Syncfusion products.

 

Your requirement to set column width can be achieved by using ‘TableLayoutMode="Fixed"’ property in GridGroupingControl . After setting

Property “TableLayoutMode” then use “Width” property to set width. Please refer the following code snippet.

 

<Syncfusion:GridGroupingControl ID="GridGroupingControl1" AutoFormat="Office 2007 Blue" TableLayoutMode="Fixed"

                runat="server" DataSourceCachingMode="ViewState" TableOptions-ShowRowHeader="false">

 

 

For your convenience , We have created the sample and the same can be downloaded from below link.

 

ColumnWidth-GridWeb.zip

 

Please let us know if you have any concerns.

 

Regards,

Yogesh R



TD TD June 20, 2012 02:42 PM UTC

Yeap... I think that only works on IE. I am using IE 8, so enabling compatibility mode with above mentioned CSS changes (max-width) works on IE too.


TD TD June 20, 2012 02:43 PM UTC

Thanks for the easy solution though.


YO Yogeshwaran Syncfusion Team June 22, 2012 09:52 AM UTC

Hi Trushith,

 Thanks for your update.

 Please let us know if you have any concerns.

 Regards,

Yogesh R


Loader.
Up arrow icon