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

Header shifts when sorted

3 Answers 45 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kosal
Top achievements
Rank 1
Kosal asked on 19 Nov 2008, 05:02 PM
Hello,

I am a using a RadGrid with headers set to be right aligned.
I've removed the sort arrows.  The problem I have having is that everytime the column is sorted the header moves about 2px over to the left.  

The header will shift over if the column is sorted Asc, or Desc. 
However onces the sort returns to the original default order the header shifts back to be right aligned.

I want it to remain right aligned no matter what.  Only the header is getting shifted over, the items remain in place. 

This is a sample of my code for one of the columns.

<

 

telerik:GridBoundColumn DataField="ItemQty" HeaderText="Qty"

 

 

SortExpression="ItemQty" UniqueName="ItemQty" ShowSortIcon="false"

 

 

AllowFiltering="False">

 

 

<HeaderStyle HorizontalAlign="Right" Width="40px"></HeaderStyle>

 

 

<ItemStyle HorizontalAlign="Right" Width="40px"/>

 

 

</telerik:GridBoundColumn>

 


Any help on this matter will be greatly appreciated.

Thanks!

3 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 20 Nov 2008, 10:14 AM
Hi Kosal,

I can't reproduce such an issue with the provided code snippet. Have you added some custom CSS rules?

Please send us your complete RadGrid declaration or a live URL.


Kind regards,
Dimo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Kosal
Top achievements
Rank 1
answered on 20 Nov 2008, 02:39 PM
Dimo,

I am using some custom CSS but I've eliminated that as a cause of the problem.  I've removed all CSS from the page and well as disabled the Skin that the grid is using and the problem still persists.

Here is the complete code for the grid.  The problem occurrs with the last three gridboundcolumns, which are all right aligned.

<

 

telerik:RadGrid ID="RadGrid1" runat="server" Width="800px" Skin="GridCustom" OnNeedDataSource="RadGrid1_NeedDataSource"

 

 

AllowSorting="True" GridLines="None"

 

 

OnItemCommand="RadGrid1_ItemCommand" ShowFooter="True"

 

 

ondeletecommand="RadGrid1_DeleteCommand" EnableEmbeddedSkins="False"

 

 

onitemdatabound="RadGrid1_ItemDataBound">

 

 

<MasterTableView CommandItemDisplay="Top" DataKeyNames="ID" AutoGenerateColumns="False">

 

 

<Columns>

 

 

<telerik:GridButtonColumn CommandName="EditRecord" ButtonType="PushButton" Text="Edit"

 

 

UniqueName="EditRecord" ShowSortIcon="false">

 

 

<ItemStyle HorizontalAlign="Center"  />

 

 

</telerik:GridButtonColumn>

 

 

<telerik:GridButtonColumn ConfirmText="Are you sure you want to delete?" ShowSortIcon="false" ButtonType="PushButton"

 

 

CommandName="Delete" Text="Delete"

 

 

UniqueName="DeleteColumn">

 

 

<ItemStyle HorizontalAlign="Center"  />

 

 

</telerik:GridButtonColumn>

 

 

<telerik:GridBoundColumn DataField="ID" HeaderText="ID" ReadOnly="True" SortExpression="ID" ShowSortIcon="false"

 

 

UniqueName="ID" Visible="False">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="ItemDescription" HeaderText="Item Description" SortExpression="ItemDescription"

 

 

UniqueName="ItemDescription" ShowSortIcon="false">

 

 

<HeaderStyle HorizontalAlign="Left"></HeaderStyle>

 

 

<ItemStyle HorizontalAlign="Left" Width="200px" />

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="ItemJustification"

 

 

HeaderText="Justification" SortExpression="ItemJustification"

 

 

UniqueName="ItemJustification" ShowSortIcon="false" >

 

 

<HeaderStyle HorizontalAlign="Left"></HeaderStyle>

 

 

<ItemStyle HorizontalAlign="Left" Width="200px" />

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="ItemQty" HeaderText="Qty"

 

 

SortExpression="ItemQty" UniqueName="ItemQty" ShowSortIcon="false"

 

 

AllowFiltering="False">

 

 

<HeaderStyle HorizontalAlign="Right" Width="40px"></HeaderStyle>

 

 

<ItemStyle HorizontalAlign="Right" Width="40px" />

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="ItemUnitPrice" DataFormatString="${0:###,###.00}"

 

 

HeaderText="Unit Price" SortExpression="ItemUnitPrice"

 

 

UniqueName="ItemUnitPrice" ShowSortIcon="false">

 

 

<HeaderStyle HorizontalAlign="Right"></HeaderStyle>

 

 

<ItemStyle HorizontalAlign="Right" Width="100px" />

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="ItemTotal" DataFormatString="${0:###,###.00}"

 

 

HeaderText="Item Price" SortExpression="ItemTotal" UniqueName="ItemTotal" ShowSortIcon="false">

 

 

<HeaderStyle HorizontalAlign="Right"></HeaderStyle>

 

 

<ItemStyle HorizontalAlign="Right" Width="100px" />

 

 

</telerik:GridBoundColumn>

 

 

</Columns>

 

 

<CommandItemTemplate>

 

 

<div style="margin: 2px 0 0 0; vertical-align: middle;">

 

 

<asp:Button ID="btnAddNew" runat="server" Text="Add New" OnClick="btnAddNew_Click" />

 

 

</div>

 

 

</CommandItemTemplate>

 

 

</MasterTableView>

 

 

<ClientSettings AllowExpandCollapse="False" AllowGroupExpandCollapse="False">

 

 

</ClientSettings>

 

 

<FilterMenu EnableTheming="True">

 

 

<CollapseAnimation Duration="200" Type="OutQuint" />

 

 

</FilterMenu>

 

 

<SortingSettings SortedAscToolTip="" SortedDescToolTip="" SortToolTip="" />

 

 

</telerik:RadGrid>

 

0
Dimo
Telerik team
answered on 20 Nov 2008, 06:04 PM
Hello Kosal,

Thanks for the RadGrid declaration. I successfully reproduced the issue and it will be fixed for the coming Q3 2008 Service Pack 1 (due next week). Your Telerik points have been updated.

Best wishes,
Dimo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Kosal
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Kosal
Top achievements
Rank 1
Share this question
or