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

Kendo Grid Edit mode Popup - Setting window Width

7 Answers 2751 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Leigh Barratt
Top achievements
Rank 1
Leigh Barratt asked on 03 Aug 2012, 04:57 AM
Hi,

I have used a Kendo Grid and set the editable mode as Popup and used custom template for editing, but I need increase the default width of the popup as the content of the template doesn't fit in the popup.

I used Window Property for the Editable and specified the Width. It applies the Title but doesn't apply the width to the window.

.Editable(ed => ed.Mode(GridEditMode.PopUp).TemplateName("EditSchool").Window(w => w.Title("Edit School Details").Name("editWindow").HtmlAttributes(new { id = "editWindow", @width = "700px" })))


Complete Code below for reference:-

@(Html.Kendo().Grid(Model)
    .Name("SchoolGrid")
    .Columns(columns =>
    {
        columns.Bound(p => p.SchoolID).Width("100px");
        columns.Bound(p => p.Name);
        columns.Bound(p => p.Campus).Width("100px");
        columns.Bound(p => p.StateCode).Width("100px");
        columns.Command(command => { command.Edit(); command.Destroy(); }).Width("180px");
    })
    .ToolBar(tb => tb.Create())
    .Editable(ed => ed.Mode(GridEditMode.PopUp).TemplateName("EditSchool").Window(w => w.Title("Edit School Details").Name("editWindow").HtmlAttributes(new { id = "editWindow", @width = "700px" })))
    .Pageable()
    .Sortable()
    .DataSource(dataSource => dataSource
        .Ajax()
        .Model(model => model.Id(p => p.SchoolID))
        .Read("Index""School")
        .Update("Edit""School")
        .Create("Create""School")
        .Destroy("Delete""School")
    )
)


Please help the needful

Cheers

7 Answers, 1 is accepted

Sort by
0
Ratna
Top achievements
Rank 1
answered on 05 Aug 2012, 08:30 PM
Hi Barratt,

I had the same issue but I solve it now.

Instead of this line:
.HtmlAttributes(new { id = "editWindow", @width = "700px" })
use below line:
.HtmlAttributes(new { @style = "width:700px;" })

This worked for me.
0
Travis
Top achievements
Rank 1
answered on 23 Aug 2012, 03:44 PM
How would you set this with the kendo web version instead of the MVC razor version I wonder?
0
Developix
Top achievements
Rank 1
answered on 06 Sep 2012, 02:27 PM
Ratna solution did not work for me.

Put the following code in the Edit event handler of the grid:

$(".k-edit-form-container").parent().width(500).height(500).data("kendoWindow").center();

Please extend your MVC APIs, Telerik MVC is still lightyears ahead!!!
0
Nick
Top achievements
Rank 1
answered on 11 Sep 2012, 02:57 PM
editable:
{
    mode: "popup"
    , template: $("#PopupTemplate").html()
},
edit: function (e) 
{
    var editWindow = this.editable.element.data("kendoWindow");
    editWindow.wrapper.css({ width: 600 });
},

Travis see the answer you are looking for above.  Good luck!!
0
Nattapong
Top achievements
Rank 1
answered on 25 Jun 2013, 10:18 AM
.Editable(editable => editable.Mode(GridEditMode.PopUp)                                 
                                  .TemplateName("SectionTemplate")
                                  .Window( w => w.Width(700))))
This worked for me. 

Window property    Width(int pixelWidth)  

0
David
Top achievements
Rank 1
answered on 10 Mar 2014, 06:29 PM
Thanks Nattapong!
0
Marty
Top achievements
Rank 1
answered on 31 Jan 2020, 05:59 PM
Thanks this worked perfectly for what I needed.
Tags
Grid
Asked by
Leigh Barratt
Top achievements
Rank 1
Answers by
Ratna
Top achievements
Rank 1
Travis
Top achievements
Rank 1
Developix
Top achievements
Rank 1
Nick
Top achievements
Rank 1
Nattapong
Top achievements
Rank 1
David
Top achievements
Rank 1
Marty
Top achievements
Rank 1
Share this question
or