Skip to content

Grid in TabStrip PartialView throws an error when there is a Sticky and ForeignKey column #8371

@eyupyusein

Description

@eyupyusein

KendoCoreTabStripGridStickyAndForeignColumn.zip

Scenario:
The Grid resides in a PartialView and this View is loaded as Content for a TabStrip.
When the Grid has both a Sticky and ForeignKey columns, the following error is thrown:

Image

Error stack trace:

Uncaught TypeError: can't access property "children", i.tbody is undefined
    _setStickyStyles kendo.all.js:146893
    _setStickyColumns kendo.all.js:146757
    _updateStickyColumns kendo.all.js:146698
    _resize kendo.all.js:155737
    resize kendo.all.js:3764
    resize kendo.all.js:4179
    each jQuery
    resize kendo.all.js:4176
    init kendo.all.js:119191
    run kendo.all.js:17147
    promise kendo.all.js:17233
    fe kendo.all.js:3230
    jQuery 5
    fe kendo.all.js:3229
    kendoAnimate kendo.all.js:3256
    v kendo.all.js:119189
    _ kendo.all.js:119211
    success kendo.all.js:119290
    jQuery 6
    ajaxRequest kendo.all.js:119309
    _ kendo.all.js:119209
    complete kendo.all.js:17209
    jQuery 3
    d kendo.all.js:16980
    jQuery 9
    transition kendo.all.js:17009
    animate kendo.all.js:17254
    run kendo.all.js:17151
    promise kendo.all.js:17233
    fe kendo.all.js:3230
    jQuery 5
    fe kendo.all.js:3229
    kendoAnimate kendo.all.js:3256
    activateTab kendo.all.js:119243
    _initialActivate kendo.all.js:120196
    init kendo.all.js:119014
    plugin/e.fn[s]/< kendo.all.js:4274
    jQuery 2
    s kendo.all.js:4273
    <anonymous> PageWithTabs:33
    jQuery 13

I have tested it with Kendo versions and the error is not there.

The error also does not appear when the page is loaded directly, e.g.:

<partial name="_GridPartialView" />
@await Html.PartialAsync("_GridPartialView")

_GridPartialView.cshtml

<div class="row">
    <div class="col-12">
        @(Html.Kendo().Grid<TelerikAspNetCoreApp2.Models.OrderViewModel>()
                            .Name("grid")
                            .Columns(columns =>
                            {
                                columns.Bound(p => p.OrderID).Filterable(false).Sticky();
                                columns.Bound(p => p.Freight).Editable("() => true");
                                columns.Bound(p => p.OrderDate).Format("{0:MM/dd/yyyy}");
                                columns.Bound(p => p.ShipName);
                                columns.Bound(p => p.ShipCity);
                                columns.ForeignKey(p => p.FkProperty,
                                        ds => ds.Read(r => r.Action("GetFkData", "Grid")),
                                        "Id",
                                        "Text");
                            })
                            .Pageable()
                            .Sortable()
                            .Scrollable()
                            .Editable(e => e.Mode(GridEditMode.InCell).Enabled(true))
                            .Groupable()
                            .Filterable()
                            .HtmlAttributes(new { style = "height:550px;" })
                            .DataSource(dataSource => dataSource
                                .Ajax()
                                .PageSize(20)
                                .Read(read => read.Action("Orders_Read", "Grid"))
                             )
        )
    </div>
</div>

PageWithTabs.cshtml

  @(
  Html.Kendo().TabStrip()
      .Name("Tabs")
      .Items(i =>
      {
          i.Add().Text("My Grid")
              .Encoded(false)
              .Selected(true)
              .LoadContentFrom("GridPartialView", "Home");
      })
  )

HomeController.cs

public class HomeController : Controller
{

    public override void OnActionExecuting(ActionExecutingContext context)
    {
        if (!string.IsNullOrEmpty(context.HttpContext.Request.Query["culture"]))
        {
            CultureInfo.DefaultThreadCurrentCulture = CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo(context.HttpContext.Request.Query["culture"]);
        }
        base.OnActionExecuting(context);
    }

    public IActionResult Index()
    {
        return View();
    }
    public IActionResult PageWithTabs()
    {
        return View();
    }

    public IActionResult GridPartialView()
    {
        return PartialView("_GridPartialView");
    }
}

I have create a new project using the code given by the customer and attaching it to the post.

Ticket ID: 1699495

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions