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

OnColumnResized firing too many times?

3 Answers 102 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jack Altiere
Top achievements
Rank 1
Jack Altiere asked on 07 Jun 2010, 03:25 PM
I have a grid, and I have the OnColumnResized client event wired up.  My problem is that it appears to be firing way too much.  I expected this to fire after the column is done being resized, but it appears to fire continuously, identical to the behavior of OnColumnResizing.

Here is my javascript function:
<script language="javascript" type="text/javascript"
function ColumnResized(sender, eventArgs) 
    var columnIndex = eventArgs.get_gridColumn().get_element().cellIndex; 
    var newWidth = eventArgs.get_gridColumn().get_element().offsetWidth; 
     
    $("#<%= txtIndex.ClientID %>").val(columnIndex); 
    $("#<%= txtWidth.ClientID %>").val(newWidth); 
</script> 
 
All I am doing at this point is updating some textboxes with jQuery after the event.  Here is my grid definition:
<telerik:RadGrid ID="radGrid" runat="server" ShowHeader="true" Width="100%" GridLines="Both"
          <ClientSettings> 
              <Resizing AllowColumnResize="true" AllowRowResize="false" ResizeGridOnColumnResize="false" EnableRealTimeResize="true" /> 
              <ClientEvents OnColumnResized="ColumnResized" OnColumnResizing="ColumnResizing" /> 
          </ClientSettings> 
          <HeaderStyle HorizontalAlign="center" /> 
          <ItemStyle HorizontalAlign="center" /> 
</telerik:RadGrid> 

The columns are being set up in the code-behind.  When I run this, The textboxes constantly update as I am resizing the column, where I expected the value to update only once, when I stop dragging the column.  Can anyone tell me why this is happening?

3 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 10 Jun 2010, 01:56 PM
Hi Jack,

Indeed this is expected and it is caused by the fact that you have set EnableRealTimeResize to true.

All the best,
Rosen
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Jack Altiere
Top achievements
Rank 1
answered on 10 Jun 2010, 02:00 PM
So is there a way to allow the client to resize the columns and still get this event to fire only once?
0
Rosen
Telerik team
answered on 11 Jun 2010, 07:00 AM
Hi Jack,

By setting EnableRealTimeResize to false you will still have columns resizing but the actual width modifications will take place when the user stops dragging.

All the best,
Rosen
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
Jack Altiere
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Jack Altiere
Top achievements
Rank 1
Share this question
or