This is a migrated thread and some comments may be shown as answers.

Pivot grid Row Field Width

8 Answers 382 Views
PivotGrid
This is a migrated thread and some comments may be shown as answers.
Syed
Top achievements
Rank 1
Syed asked on 05 Nov 2013, 04:42 AM

Hi,
In my Pivot table i want to set the width for each column of row Filed.

I set the column width like this.

                        <telerik:PivotGridRowField DataField="Maintype"  Caption="" CellStyle-Width="60px"     >
                </telerik:PivotGridRowField>
                   <telerik:PivotGridRowField DataField="subtype"  Caption="" CellStyle-Width="60px"  >
                </telerik:PivotGridRowField               
                <telerik:PivotGridRowField DataField="Listtype"  Caption="" CellStyle-Width="110px"  >
                </telerik:PivotGridRowField>

but i found some stange result as the width for each column is in irregular form.
means first column width set to second column and last column with is not changing
Please check the attached image for details.

I dont want to use the RowHeaderCellStyle widh ,because this will set the same width for all the row field column.

I want to set the Individual column width of rowfield.



8 Answers, 1 is accepted

Sort by
0
Venelin
Telerik team
answered on 07 Nov 2013, 12:22 PM
Hello Syed,

I am afraid that based on the provided information the issue is not replicating on my side. I created a sample project where the CellStyle-Width property is working as expected. Could you please examine it and tell what should be changed in order to reproduce the problem?

ASPX:

<telerik:RadPivotGrid ID="RadPivotGrid2" runat="server" Width="1200px"
    AllowPaging="true" OnNeedDataSource="RadPivotGrid_NeedDataSource">
    <Fields>
        <telerik:PivotGridRowField DataField="TransportType" CellStyle-Width="150px" CellStyle-ForeColor="blue">
        </telerik:PivotGridRowField >
        <telerik:PivotGridRowField DataField="Company" CellStyle-Width="250px"  CellStyle-ForeColor="Green">
        </telerik:PivotGridRowField>
        <telerik:PivotGridColumnField DataField="Country">
        </telerik:PivotGridColumnField>
        <telerik:PivotGridColumnField DataField="City">
        </telerik:PivotGridColumnField>
        <telerik:PivotGridAggregateField DataField="Profit" Aggregate="Sum" DataFormatString="{0:C}">
        </telerik:PivotGridAggregateField>
    </Fields>
</telerik:RadPivotGrid>

C#:

public DataTable GetDataTable(string query)
{
    String ConnString = ConfigurationManager.ConnectionStrings["TelerikConnectionString"].ConnectionString;
    SqlConnection conn = new SqlConnection(ConnString);
    SqlDataAdapter adapter = new SqlDataAdapter();
    adapter.SelectCommand = new SqlCommand(query, conn);
 
    DataTable myDataTable = new DataTable();
 
    conn.Open();
    try
    {
        adapter.Fill(myDataTable);
    }
    finally
    {
        conn.Close();
    }
 
    return myDataTable;
}
 
protected void RadPivotGrid_NeedDataSource(object sender, PivotGridNeedDataSourceEventArgs e)
{
 
 
    


Regards,
Venelin
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Barbaros Saglamtimur
Top achievements
Rank 1
answered on 11 Nov 2013, 11:26 AM
I have same problem and solved as giving width at run-time like;
RadPivotGrid1.Fields.GetFieldByUniqueName("CustomerNameCell").CellStyle.Width = Unit.Pixel(175);
0
Syed
Top achievements
Rank 1
answered on 18 Dec 2013, 08:04 AM
Hi ,
I find the cause for not setting the width for each column of row field
.if we use the Scrolling-AllowVerticalScroll="true" the Column width is miss matching.
Find the attached image for more details

If i not used the Allow Scroll : The Row Field width Works fine Check the attached image PivotGridBeforeusingScroll
<telerik:RadPivotGrid ID="RadPivotGrid2" runat="server" Width="100%" Height="500px" CellPadding="2"  Skin="Office2010Blue"
           CellSpacing="2" Culture="ko-KR" GridLines="None"  HorizontalAlign="Center"  ShowFilterHeaderZone="false"
   AllowPaging="false" OnNeedDataSource="RadPivotGrid_NeedDataSource" AllowFiltering="false" ShowDataHeaderZone="false" ShowRowHeaderZone="true" 
        ShowColumnHeaderZone="false" 
            oncelldatabound="RadPivotGrid2_CellDataBound">
             <TotalsSettings RowsSubTotalsPosition="None" RowGrandTotalsPosition="None"
        ColumnsSubTotalsPosition="None" ColumnGrandTotalsPosition="None" />
            <Fields>
    <telerik:PivotGridRowField DataField="TransportType" CellStyle-Width="30px" CellStyle-ForeColor="blue" Caption="Row">
    </telerik:PivotGridRowField >
    <telerik:PivotGridRowField DataField="Company" CellStyle-Width="250px"  CellStyle-ForeColor="Green">
    </telerik:PivotGridRowField>
    <telerik:PivotGridColumnField DataField="Country">
    </telerik:PivotGridColumnField>
    <telerik:PivotGridColumnField DataField="City">
    </telerik:PivotGridColumnField>
    <telerik:PivotGridAggregateField DataField="Profit" Aggregate="Sum" CellStyle-Width="30px" DataFormatString="{0:C}">
    </telerik:PivotGridAggregateField>
   </Fields>
  </telerik:RadPivotGrid>

If i not used the Allow Scroll : The Row Field width Works fine Check the attached image PivotGridAfterusingScroll2

<telerik:RadPivotGrid ID="RadPivotGrid2" runat="server" Width="100%" Height="500px" CellPadding="2"  Skin="Office2010Blue"
           CellSpacing="2" Culture="ko-KR" GridLines="None"  HorizontalAlign="Center"  ShowFilterHeaderZone="false"
   AllowPaging="false" OnNeedDataSource="RadPivotGrid_NeedDataSource" AllowFiltering="false" ShowDataHeaderZone="false" ShowRowHeaderZone="true" 
        ShowColumnHeaderZone="false" 
            oncelldatabound="RadPivotGrid2_CellDataBound">
             <TotalsSettings RowsSubTotalsPosition="None" RowGrandTotalsPosition="None"
        ColumnsSubTotalsPosition="None" ColumnGrandTotalsPosition="None" />
         <ClientSettings Scrolling-AllowVerticalScroll="true"  Scrolling-SaveScrollPosition="true" > </ClientSettings>
   <Fields>
    <telerik:PivotGridRowField DataField="TransportType" CellStyle-Width="30px" CellStyle-ForeColor="blue" Caption="Row">
    </telerik:PivotGridRowField >
    <telerik:PivotGridRowField DataField="Company" CellStyle-Width="250px"  CellStyle-ForeColor="Green">
    </telerik:PivotGridRowField>
    <telerik:PivotGridColumnField DataField="Country">
    </telerik:PivotGridColumnField>
    <telerik:PivotGridColumnField DataField="City">
    </telerik:PivotGridColumnField>
    <telerik:PivotGridAggregateField DataField="Profit" Aggregate="Sum" CellStyle-Width="30px" DataFormatString="{0:C}">
    </telerik:PivotGridAggregateField>
   </Fields>
  </telerik:RadPivotGrid>

how to solve this ?
0
Konstantin Dikov
Telerik team
answered on 20 Dec 2013, 01:11 PM
Hi Syed,

As we have discussed in your Support Ticker regarding the same issue, this seems to be a bug with the RadPivotGrid when vertical scrolling is enabled.

I have opened a new item in our Ideas & Feedback portal, where you could keep track of its progress and see the available temporary workaround.

Once again, please excuse us for any inconvenience caused by this.


Regards,
Konstantin Dikov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
J2K
Top achievements
Rank 1
answered on 10 Mar 2016, 06:22 PM

As of releases through 2015, still no fix for the problem Syed cites, as I experienced exactly what he describes, with both 2014 and 2015 releases.  Setting Scrolling-AllowVerticalScroll ="false" seems to be the only hope of ending up with column widths that make any sense given the actual data displayed.

 

 

0
Konstantin Dikov
Telerik team
answered on 11 Mar 2016, 06:55 AM
Hi,

The fix was introduced in Q1 2016, so upgrading to that version should resolve the issue. Can you please upgrade to Q1 2016 and let us know if everything works correctly on your side? 

Looking forward to your reply.


Regards,
Konstantin Dikov
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
J2K
Top achievements
Rank 1
answered on 17 Mar 2016, 05:20 PM

Thanks, but no, won't be changing to 2016 version of Telerik ASP NET controls as I didn't renew the subscription, while I appreciate the many good features of the controls, this kind of odd display behavior of RadControls I've learned over the years is simply endemic with the controls.  And way too often, the response from support was "I can't replicate" or "will be fixed in the next version" After many hours of futzing, the solution here was to wrap the pivot grid in a div with the div's overflow set to auto, and set the pivotgrid's height to a level that would result in the div's scrollbar displayed as needed.  This allowed setting the pivotgridrowfield to a reasonable width so it's value wasn't wrapped 2, 3, and in a few cases, 4 lines deep, and stlll being able to reach all the rows.  The other oddity is setting the pivotgridcolumn field width, setting it to anything caused unpredictable results, most often the total and/or grand totals are not displayed or chopped in half.  The only solution was not setting the desired header width and/or  column widths.

 

0
Konstantin Dikov
Telerik team
answered on 22 Mar 2016, 08:58 AM
Hello Mark,

Let me start by saying that we are constantly trying to improve our product and to fix all reported issues, but in some cases, without a sample project that replicates the bug it is impossible to pinpoint the root of the issue and provide a fix for it.

I want to assure you that our goal is to always improve the controls and cover as many scenarios as possible.

If you have encounter another issue with the width that is replicated with our latest version (you can download the trial version for testing) you can open a new "Bug report" thread with a RadPivotGrid configuration that replicates the problem.


Best Regards,
Konstantin Dikov
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
PivotGrid
Asked by
Syed
Top achievements
Rank 1
Answers by
Venelin
Telerik team
Barbaros Saglamtimur
Top achievements
Rank 1
Syed
Top achievements
Rank 1
Konstantin Dikov
Telerik team
J2K
Top achievements
Rank 1
Share this question
or