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

Loading a Kendo Grid into Window causing Center to not work

1 Answer 133 Views
Window
This is a migrated thread and some comments may be shown as answers.
Ryan Lege
Top achievements
Rank 1
Ryan Lege asked on 22 Aug 2012, 12:58 PM

   
THIS GRID IS LOCATED IN A PARTIAL-
@(Html.Kendo()
      .Grid<USARAFSyncMVC.Areas.Event.Models.PaxModel>(Model.EventPaxBreakDowns)
      .Name("PaxGrid")
      .DataSource(dataSource => dataSource
                                          .Ajax()


                                          .Model(model => model.Id(p => p.PaxBDID))
                                          .Create(update => update.Action("_InsertPax", "Event", new { Area = "Event" }))
                                          .Update(update => update.Action("_SavePax", "Event", new { Area = "Event" }))
                                          .Destroy(update => update.Action("_DeletePax", "Event", new { Area = "Event" })))
      .Columns(columns =>
      {
          columns.Bound(p => p.CountryTitle);
          columns.Bound(p => p.MilitaryPlanned);
          columns.Bound(p => p.MilitaryActual);
          columns.Bound(p => p.CivilianPlanned);
          columns.Bound(p => p.CivilianActual);
          columns.Command(command => { command.Edit(); command.Destroy(); }).Width(200).Title("Actions");
      })

      .Pageable()
      .Scrollable()
      .ToolBar(toolbar => toolbar.Create())
      .Sortable()
)

IT IS THEN LOADING DYNAMICALLY INTO THIS WINDOW-

 $("#windowcontainer").append("<div id='window'></div>");


    var mywindow = $("#window").kendoWindow({
        title: title,
        content: { url: url },
        visible: false,
        draggable: false,
        modal: true,
        animation: false,
        onclose: onclose,
        onopen:onOpen, 
        deactivate: function () {
            this.destroy();
        }
    }).data("kendoWindow");
    mywindow.center();
    mywindow.open();


It centers then the grid throws it off and it seems to anchor to the right of the screen. When I try to drag it, it expands, and it's right side stays anchored to the right side of the browser. When I resize, then I am able to drag it. 

But I do not want any of that to happen, I would like it to just center in the first place. 

BTW: It works fine without a grid!


Thanks





1 Answer, 1 is accepted

Sort by
0
Accepted
Dimo
Telerik team
answered on 22 Aug 2012, 01:22 PM
Hello Benjamin,

The Window needs an explicit width in this case, as in all other cases, in which it contains something that can expand horizontally.

On a side note, you can chain methods - mywindow.center().open();

Regards,
Dimo
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Window
Asked by
Ryan Lege
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or