Grid Edit PopUp Window - Center on Resize

2 posts, 0 answers
  1. Greg
    Greg avatar
    6 posts
    Member since:
    Apr 2009

    Posted 29 Mar 2016 Link to this post

    I have a Kendo Grid that is formatted to edit in a popup window with a custom template:

    .Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("MyEditor").Window(w => w.Resizable().Events(e => e.Resize("popupResize"))))

    That popup edit window template ("MyTemplate") has multiple controls on it which includes a Kendo TabStrip.  One of the tabstrip items contains another Kendo Grid.  Depending on the datasource of that grid, the width and height of the popup window may change.  This may even take the edit popup window partially off the screen.

    The problem is that the Resize event (which I'm subscribing to as shown above) of the grid popup window doesn't fire when the window's size changes due to changes in the content.  It only fires if the user resizes the window with their mouse.

    Is there a way to know when the content width/height of a popup edit window changes so I can call the center() method on the edit popup window?

  2. Dimiter Topalov
    Dimiter Topalov avatar
    1047 posts

    Posted 31 Mar 2016 Link to this post

    Hello Greg,

    The resize event of the Kendo UI Window is fired only when the widget is resized by the user. There are couple of other events you can handle, depending on when exactly the Grid that is inside the TabStrip is populated with data and expands the Kendo UI Window.

    You can use either the activate event of the TabStrip or dataBound event of the Grid, get a reference to the closest parent Kendo UI Window and center it in the handler.

    An alternative approach would be to set fixed dimensions for the Window (.Width(...).Height(...)) and make the Grid scrollable (...Scrollable(True)), so you would not need to center the Window every time the Grid comes up with different size.

    Let me know if you need further assistance.

    Dimiter Topalov
    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