API for resizing columns on client side using javascript

7 posts, 0 answers
  1. Mirang
    Mirang avatar
    6 posts
    Member since:
    Jun 2012

    Posted 18 Jul 2012 Link to this post

    Does the Grid has any client side API for column resizing using javascript?
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 18 Jul 2012 Link to this post

    Hi Mirang,

    You can use the client event OnColumnResizing in javascript for catching resizing of columns.
    aspx:
    <telerik:RadGrid runat="server">
      <ClientSettings>
        <ClientEvents OnColumnResizing="OnColumnResizing" />
        <Resizing AllowColumnResize="True" AllowRowResize="false" ResizeGridOnColumnResize="false"
          ClipCellContentOnResize="true" EnableRealTimeResize="false" AllowResizeToFit="true" />
      </ClientSettings>
      ...
    </telerik:RadGrid>

    JS:
    function OnColumnResizing(sender,args) {
    alert("fired");
    }

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Mirang
    Mirang avatar
    6 posts
    Member since:
    Jun 2012

    Posted 18 Jul 2012 Link to this post

    I wanted to resize the columns from the javascript code. I just got across this link

    http://www.telerik.com/community/forums/aspnet-ajax/grid/get-set-column-width-from-client-side.aspx 

    Is it useful ?
  5. Antonio Stoilkov
    Admin
    Antonio Stoilkov avatar
    530 posts

    Posted 23 Jul 2012 Link to this post

    Hi Mirang,

    You could achieve your scenario by using the RadGrid client-side API which provides way to resize table view columns. Every GridTableView client-side object includes resizeColumn function which usage is described in the help article below.

    Additionally, the example below shows how to use the resizeColumn method specifying the column index as first parameter and its width for seconds parameter.
    $find("RadGrid1").get_masterTableView().resizeColumn(1, 120)

    Greetings,
    Antonio Stoilkov
    the Telerik team
    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 their blog feed now.
  6. Teju
    Teju avatar
    10 posts
    Member since:
    Jul 2012

    Posted 10 Sep 2015 Link to this post

    How to set AllowColumnResize=true at  client side using javascript in master pages using the CSS selector , so that it would apply to all the grid specified.
  7. Teju
    Teju avatar
    10 posts
    Member since:
    Jul 2012

    Posted 10 Sep 2015 Link to this post

    After a long debugger mode searching , finally my friend found the property -

    grid.get_masterTableView()._owner.ClientSettings.Resizing.AllowColumnResize=true;

     

  8. Eyup
    Admin
    Eyup avatar
    3005 posts

    Posted 11 Sep 2015 Link to this post

    Hello Teju,

    You can even shorten it as follows:
    grid.ClientSettings.Resizing.AllowColumnResize=true;

    Hope this helps.

    Regards,
    Eyup
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017