RadGrid Column Reorder instead of Swap

Thread is closed for posting
11 posts, 0 answers
  1. Philip
    Philip avatar
    5 posts
    Member since:
    Nov 2004

    Posted 10 Oct 2006 Link to this post

    Requirements

    RadGrid version

    4.x or later

    .NET version

    2.0

    Visual Studio version

    VS 2005

    programming language

    Javascript

    browser support

    all browsers supported by RadGrid


    PROJECT DESCRIPTION

    This file contains an example script to reorder columns when a user drags a column instead of swapping them.  It was created in response to this thread (http://www.telerik.com/community/forums/thread/b311D-edccg.aspx).

    To use it, simply copy and paste it into a script block on the page with the r.a.d.grid.  Then bind up the client events; OnGridCreated & OnColumnSwapping.

    Known Issues:
    Currently this script will not work if UseStaticHeaders is enabled on the ClientSettings.Scrolling element.  The data will appear in the correct column but the header will not re-order.

    Feedback:
    I welcome all feedback.  I don't know how much I will check this thread, but you can contact me through my web site at http://www.philipwolfe.com/.
  2. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 13 Oct 2006 Link to this post

    Hello Philip,

    Thank you for sharing your implementation in this post - it appears to be cross-browser solution and works under IE, Gecko-based browsers, Opera, etc. There is a minor glitch under Internet explorer only which appears occasionally (the default swapping mechanism is triggered first and then the proper reordering is propagated).
    Nevertheless, this is an excellent solution - we have added 3500 telerik points to your account for the involvement. Most probably this mechanism will become part of the internal client object model of the grid in one of its future versions.

    I have assembled a demo version which uses your code logic (attached to this message).

    Happy coding and keep posting,
    Stephen
    the telerik team
  3. Rick
    Rick avatar
    12 posts
    Member since:
    Oct 2006

    Posted 17 Oct 2006 Link to this post

    Hi Stephen,

    Thanks for this example. The column swapping works well. I have a problem though. When I click on the Sort Column the grid goes away and wont come back until I press the postback button.

    How do I get the grid to do a postback?

    Thanks,
    Rick
  4. Rick
    Rick avatar
    12 posts
    Member since:
    Oct 2006

    Posted 17 Oct 2006 Link to this post

    I meant to add this to my last reply. When swapping columns and then choosing to sort, it sorts on the column that was there and not the new column?

    How do you get around this?

    Thanks,
    Rick
  5. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 18 Oct 2006 Link to this post

    Hello Rick,

    The example worked as expected on my end - I was not able to replicate the issues you have mentioned. Did you modify the demo to some point? Make sure that you have not set EnableViewState="false" for the grid or use simple data-binding without rebinding the grid on sorting operation.
    To simplify your code logic you can attach the NeedDataSource event or generate the grid content through data source control (as in the sample project).

    Kind regards,
    Stephen
    the telerik team
  6. Rick
    Rick avatar
    12 posts
    Member since:
    Oct 2006

    Posted 18 Oct 2006 Link to this post

    Hi Stephen,
    We are developing an industrial strength application to be used by 100+ users on the Internet specific to one company (not the general public).These people are going to be using this product for 8+ hours a day and we need it to be solid.

    We would really like to use your product, however my development team has spent countless hours trying to get your controls to work 100%. Here are the parameters that cannot change on this project:

    .net 2.0 (we are using Q3 controls)
    sql server database
    Masterpages must be used
    must be able to have many controls with in one tabstrip (200+)
    ie 6
     XP Professional on the clients

    I am having troubles with the following:
    rad combo box: using the  "externalcallbackpage= " functionality. I find that it calls the callback page and I can debug through it but the values won't post back to the originating dropdown. If I take the exact same code out of the masterpage scenario, it works perfectly.

    RadGrid:
    When I click on the column header to sort a column, the page goes away and won't return until I click on a button to do a postback. Here is my grid setup:

    <radG:RadGrid ID="RadGrid1" Skin="3D" runat="server" AllowPaging="True" AllowSorting="True" GridLines="None" PageSize="10" Width="45%"><ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True"><Resizing AllowRowResize="True" AllowColumnResize="True"></Resizing></ClientSettings></radG:RadGrid>

    I am feeding the data on page load from sql server:
    RadGrid1.DataSource = ud.GetServiceType();
    RadGrid1.DataBind();

    In my testing application project I have approximately 20 rad controls. When I press F5 to go into debug mode it takes a very long time for the debug session to come up. When this application is complete, I would expect to have in excess of 1000 rad controls in it. Is there a problem with a large number of rad controls 1) in a devleopment environment? 2) in a production environment?

    These are just a few of the problems we are having. Would it be better if we spoke on the telephone. Of course we have tight delivery time lines. We thought that using your controls would get us some great functionality in a quick manner. Our experience has been quite the opposite.

    Your prompt reply would be greatly appreciated.
    Rick
  7. Nikolay
    Admin
    Nikolay avatar
    3997 posts

    Posted 19 Oct 2006 Link to this post

    Hi Rick,

    We are  sorry to hear that you are having trouble with configuring some of our controls to work properly in your scenario. We will do our best to address the issues you have encountered so far and will gladly help you additionally if needed: 

    1. I suggest that you check the following article as it handles all the needed information:
      When is the ExternalCallBackPage needed?
    2. As we have mentioned in our previous post:

      To simplify your code logic and make sure that the grid built-in operations will work without problems, you can attach the NeedDataSource event or generate the grid content through data source control (as in the sample project).
      Note that this data source control can be SqlDataSource control - thus you can perform automatic operations as in the online demo linked above. The code in the code-behind is merely for error handling - not even a single line is required to refresh the source data. Please review the relevant resources for more info.
      I should inform you that if you prefer simple data-binding you have to be aware of the limitations it brings - they are outlined clearly in these resources:

      http://www.telerik.com/demos/aspnet/Grid/Examples/Programming/SimpleBinding/DefaultVB.aspx

      http://www.telerik.com/help/radgrid/v4_Net2/?grdSimpleDatabinding.html
    3. Since our r.a.d.controls implement complicated server and cilent-side logic, they all need page resources to work properly. Placing thousands of r.a.d.controls on your page might result in a time-consuming page refresh. You can ajaxify the controls for a better performance, like shown here:
      AJAX Integration
    Kind regards,
    Nick
    the telerik team
  8. Strider1981
    Strider1981 avatar
    1 posts
    Member since:
    Feb 2007

    Posted 20 Feb 2007 Link to this post

    Works very nice. Only problem is the grid does not keep the same order when you change the page or sort on any column. Is there any work arround for that?

    Thanks,
    Amit
  9. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 20 Feb 2007 Link to this post

    Hello Amit,

    We are enclosing a sample project (with the latest unofficial grid build) where this functionality is built-in and let us know if you have any questions. The official SP is scheduled at the end of this month.

    Kind regards,
    Vlad
    the telerik team
  10. Sarju
    Sarju avatar
    13 posts
    Member since:
    Mar 2007

    Posted 19 Mar 2007 Link to this post

    Hi,
     Do you have a build for .NET 1.1, wherein this functionality is built-in?

    Thanks,
    -Sarju Mehta
  11. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 20 Mar 2007 Link to this post

    Hello Sarju,

    You can find this functionality in the current official grid 4.5.2.

    All the best,
    Vlad
    the telerik team
Back to Top