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

[Solved] Pop-up Edit Form Position Issue

2 Answers 134 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Scott Kuhn
Top achievements
Rank 1
Scott Kuhn asked on 21 Jan 2012, 05:28 PM
Hi,
I am attempting to center the pop-up edit form and have tried the previously posted solutions with mixed results.

I have one grid that works using the solution:
@(Html.Telerik().Grid(Model.RFQFiles).Name("FileGrid")
    .ToolBar(c => c.Insert().ButtonType(GridButtonType.Text))
    .Editable(c => c.Mode(GridEditMode.PopUp).DefaultDataItem(
            new RFQFile
            {
                RFQID = Model.RFQID,
                EditUserID = ViewBag.UserID,
                CreateUserID = ViewBag.UserID
            }).FormHtmlAttributes(new { id = "FileGridform", name = "FileGridform" }))
    .DataKeys(keys =>
    {
        keys.Add(f => f.RFQFileID);
        keys.Add(f => f.RFQID).RouteKey("RFQID");
    })
    .DataBinding(dataBinding =>
    {
        dataBinding.Ajax()
            .Insert("_InsertDocument", "RFQRequest")
            .Select("_SelectDocument", "RFQRequest")
            .Update("_UpdateDocument", "RFQRequest")
            .Delete("_DeleteDocument", "RFQRequest");
 
    })
    .Columns(columns =>
    {
        columns.Command(c => c.Delete().ButtonType(GridButtonType.Text));
        columns.Bound(f => f.Name).Title("File Name");
        columns.Bound(f => f.Detail).Title("Description");
    })
    .ClientEvents(events => events.OnDataBinding("onGridDataBinding").OnDataBound("onFileGridDataBound").OnEdit("onGridEditing").OnSave("onSave"))
    .NoRecordsTemplate("Loading, please wait...")
)

Using the following on edit
function onGridEditing(e) {
    $(e.form)
        .closest(".t-window")
        .css("marginLeft", 0)
        .data("tWindow")
        .center();
}

But with the following grid I get an error in the javascript indicating that center() is undefined.  That error is resulting from .data("tWindow") returning null.  (Of course the pop-up is not centered when the error occurs.)
@(Html.Telerik().Grid(Model.RFQParts).Name("PartGrid")
    .ToolBar(c => c.Insert().ButtonType(GridButtonType.Text))
    .Editable(c => c.Mode(GridEditMode.PopUp).DefaultDataItem(
            new RFQPart {
                RFQID = Model.RFQID,
                EditUserID = ViewBag.UserID,
                CreateUserID = ViewBag.UserID
            }).FormHtmlAttributes(new { id = "PartGridform", name = "PartGridform" }))
    .DataKeys( keys => {
        keys.Add(f => f.RFQPartID);
        keys.Add(f => f.RFQID).RouteKey("RFQID");
    })
    .DataBinding(dataBinding =>
    {
        dataBinding.Ajax()
            .Insert("_InsertPart", "RFQRequest")
            .Select("_SelectParts", "RFQRequest")
            .Update("_UpdatePart", "RFQRequest")
            .Delete("_DeletePart", "RFQRequest"); 
             
    })
    .Columns(columns =>
    {
        columns.Bound(p => p.ProgramName).Title("Program");
        columns.Bound(p => p.ApplicationLabel).Title("Application");
        columns.Bound(p => p.CatalogPart).Title("Allegro / Sanken Part");
        columns.Bound(p => p.TargetASP).Title("Target Price");
    })
    .ClientEvents(events => events.OnDataBinding("onGridDataBinding").OnDataBound("onPartGridDataBound").OnEdit("onGridEditing"))
    .NoRecordsTemplate("Loading, please wait...")
)

In fact both of these grids are in the same view, and I can edit as many times as I want with the first grid and I get no error.  Once I edit with the second grid, I get the error and then I get the error for both grids.

I've tested in both IE 9 and FF 8.  Using MVC Extensions Q2 2011.






2 Answers, 1 is accepted

Sort by
0
Scott Kuhn
Top achievements
Rank 1
answered on 23 Jan 2012, 07:08 PM
I have resolved this issue; I think.

Though I am not sure why, I am no longer get the javascript error.  

I am chalking it up to there being an issue in the EditorTemplate.
0
Joe
Top achievements
Rank 2
answered on 15 Sep 2012, 05:49 PM
This suggestion works nicely.
Thanks for sharing it with "us".
Joe
Tags
Grid
Asked by
Scott Kuhn
Top achievements
Rank 1
Answers by
Scott Kuhn
Top achievements
Rank 1
Joe
Top achievements
Rank 2
Share this question
or