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

Error with Grid in Window

5 Answers 116 Views
Window
This is a migrated thread and some comments may be shown as answers.
Steven
Top achievements
Rank 1
Steven asked on 12 Feb 2013, 12:08 AM
Currently I am receiving an error when accessing a Kendo Window of a partial page with a Grid inside:

SCRIPT5022: DOM Exception: NOT_FOUND_ERR (8) 
kendo.web.min.js, line 16 character 31193

l.table[0].replaceChild(r,l.tbody[0])

My window Kendo window code is as follows:

@(Html.Kendo().Window()
                    .Name("mbWindow")
                    .Width(630)
                    .Height(530)
                    .Title("Add Element")
                    .Content(
                    @<text>
                    @Html.Partial("../Controller/PartialPage")
                    </text>)
                    .Draggable()
                    .Visible(false))

My partial page is as follows:

@{
    ViewBag.Title = "Elements";
}
<h2>
    Elements</h2>
<div id="mxBWindow">
    @(Html.Kendo().Grid<Model.MB>()
            .Name("MBGrid")
                .HtmlAttributes(new { style = "height:460px;" })
            .Columns(columns =>
            {
                columns.Bound(p => p.ID);
                columns.Bound(p => p.Amount);
                columns.Bound(p => p.ParentID);
                columns.Command(command => command.Destroy()).Width(110);
            })
            .ToolBar(toolbar =>
            {
                toolbar.Create();
                toolbar.Save();
            })
            .Editable(editable => editable.Mode(GridEditMode.InCell))
            //.Pageable()
            //.Sortable()
            //.Selectable(s => s.Enabled(true))
            //.Navigatable(n => n.Enabled(true))
            .DataSource(dataSource => dataSource
                .Ajax()
                .Batch(true)
                .ServerOperation(false)
                .Events(events => events.Error("error_handler"))
                .Model(model => model.Id(p => p.ID))
                        .Create("Editing_Create", "Grid")
                        .Read("Editing_Read", "Grid")
                        .Update("Editing_Update", "Grid")
                        .Destroy("Editing_Destroy", "Grid")
            )
                .Events(ev => ev.SaveChanges("submitElements"))
    )
</div>

I have noticed that when I remove this Grid from the partial page, the window gives me no errors. Both pages, however, when accessed individually give me no errors. Yet when I add the Grid back in with the Kendo Window, I get the DOM Exception.

Page w/Grid - No Errors
Page w/Window - No Errors
Page w/Window(w/Grid Inside) - Error/DOM Exception

Could someone please point me out what might be causing this error?

5 Answers, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 13 Feb 2013, 03:43 PM
Hello Steven,

I am not sure what could be the reason, usually there are problem because the scripts are loaded multiple times, however I do not think this is the case for you.

If you put this into a demo project we could easily see the reason for that behavior.

Kind regards,
Petur Subev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Steven
Top achievements
Rank 1
answered on 13 Feb 2013, 05:40 PM
Which scripts might be loaded multiple times?
0
Petur Subev
Telerik team
answered on 15 Feb 2013, 12:38 PM
Hello again Steven,

Basically if jQuery is loaded multiple times the widgets registered into the memory are cleared. However as I said I am not sure if this is the reason for you case. 
I will need a project to investigate the exact reason.

Kind Regards,
Petur Subev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Louis
Top achievements
Rank 1
answered on 02 May 2013, 07:05 PM
I'm getting the same thing, same scenario, a Grid inside a Window, during the refresh: event for the grid.

Kendo UI Complete v2012.2.913
line 19362

if (tbodySupportsInnerHtml) {
that.tbody[0].innerHTML = html;
} else {
placeholder = document.createElement("div");
placeholder.innerHTML = "<table><tbody>" + html + "</tbody></table>";
tbody = placeholder.firstChild.firstChild;
EXCEPTION: ---->>>>> that.table[0].replaceChild(tbody, that.tbody[0]);  <<<<<----- EXCEPTION
that.tbody = $(tbody);
}


0
Louis
Top achievements
Rank 1
answered on 03 May 2013, 05:17 PM
I found my problem: I was initializing the grid every time window.open was being fired.  I added a clause to check whether the grid was already a kendoGrid and if not, initialize, if so, refresh the datasource.
Tags
Window
Asked by
Steven
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Steven
Top achievements
Rank 1
Louis
Top achievements
Rank 1
Share this question
or