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

[Solved] [BUG] .DropDownHtmlAttributes causes nested grid malfunctioning

1 Answer 70 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.
Joan Vilariño
Top achievements
Rank 2
Joan Vilariño asked on 16 Sep 2010, 08:26 AM
Hi... I've detected what I guess must be a bug in the Grid control.

I have this grid (master/detail):

<%= Html.Telerik().Grid<myMasterModel>() 
      .Name("MasterGrid")
      .Pageable(page => page.PageSize(15).Position(GridPagerPosition.Both))
      .ClientEvents(ev => ev.OnError("onMasterError"))
      .Sortable(order => order.OrderBy(o=>o.Add(e=>e.Name)).SortMode(GridSortMode.MultipleColumn))
      .Scrollable(scroll => scroll.Height(300))
      .DataKeys(datakeys => datakeys.Add(o => o.Id))
      .ToolBar(tb => tb.Insert())
      .Editable(conf => conf.Enabled(true))
      .DataBinding(databinding => databinding.Ajax()
          .Select("_Select","myController")
          .Update("_Update", "myController")
          .Delete("_Delete", "myController")
          .Insert("_Insert","myController"))
      .Columns(columns =>
                   {
                       columns.Command(cm =>
                                           {
                                               cm.Edit();
                                               cm.Delete();
                                           })
                           .Width(180).Title("Actions");
                       columns.Bound(o => o.Name).Width(250);
                       columns.Bound(o => o.Description);
                   })
      .DetailView(dv => dv.ClientTemplate(
          // Nested (child) grid
          Html.Telerik().Grid<myChildModel>()
              .Name("ChildGrid_<#= Id #>")
              .DataKeys(keys => keys.Add(o => o.Id))
              .ClientEvents(ev => ev.OnError("onChildError").OnSave("onChildSave"))
              .DataBinding(databind => databind.Ajax()
                              .Select("_ChildSelect", "myController", new { masterId = "<#= Id #>" })
                              .Delete("_ChildDelete", "myController", new { masterId = "<#= Id #>" })
                              .Update("_ChildUpdate", "myController", new { masterId = "<#= Id #>" })
                              .Insert("_ChildInsert", "myController", new { masgterId = "<#= Id #>" }))
              .ToolBar(tb => tb.Insert())
              .Columns(columns =>
              {
                  columns.Command(cm =>
                                      {
                                          cm.Edit();
                                          cm.Delete();
                                      }).Title("Actions").Width(180);
                  columns.Bound(o => o.Child).ClientTemplate("<#= Child.Name#>").Title("Child");
                  columns.Bound(o => o.Child.SomeProp.Nombre).ReadOnly().Title("SomeProp").Width(150);
                  columns.Bound(o => o.Child.SomeOtherProp.Nombre).ReadOnly().Title("SomeOtherProp").Width(150);
                  columns.Bound(o => o.Child.Code).ReadOnly().Title("Code").Width(150);
              })
              .Sortable()
              .Editable(conf => conf.Enabled(true))
              .Pageable(action => action.PageSize(5))
              .Filterable().ToHtmlString()))
      %>

Ok, now the 2nd column of the child grid (the one bound to o.Child) has a template with a Telerik.ComboBox like this:

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<ChildClass>" %>
<%=Html.Telerik().ComboBox().Name("Child")
        .Filterable(ft => ft.FilterMode(AutoCompleteFilterMode.Contains).MinimumChars(5))
        .DataBinding(db => db.Ajax().Select("_selectChildComboboxItems", "myController"))
        .ClientEvents(ev => ev.OnChange("checkComboBox"))
        .DropDownHtmlAttributes(new { style = "width:300px" })
%>
  
<script type="text/javascript">
    $(document).ready(function() { bindGridComboBox("Child"); });
</script>

I run this, and when I click on the nested (child) grid's "Edit" or "Insert" button, is the master grid the one that enters edit mode or adds a new record and enters edit mode.

If I remove the .DropDownHtmlAttributes() call from the template's combobox builder, everything works as expected.

Is this a reported bug?

Thanks!!!

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 16 Sep 2010, 05:04 PM
Hello Joan VilariƱo,

Thank you for drawing our attention to this issue.

I am glad to inform you that it is fixed and the fix will be included in the next official release of the Telerik Components for ASP.NET MVC.

For your convenience I have attached latest internal build which includes fix of the problem.

I have updated your Telerik points.

Best wishes,
Georgi Krustev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Joan Vilariño
Top achievements
Rank 2
Answers by
Georgi Krustev
Telerik team
Share this question
or