I am trying to use the Grid / Checkbox selection feature in nested grids, inside client detail templates.
I am in face of a disturbing issue because the "select all" operation (by using the checkbox in the header) is always done in the first row having details.
To be clearer, suppose having a master grid with only 2 rows. Each row has a detail template containing a nested grid. Expand the 2 detail templates and try to select all the rows of the 2nd nested grid => That selects all the rows of the 1st one.
Have you an idea to help me ?
Thank you in advance.
Hereafter my shortened code of the view (the full version is attached):
@(Html.Kendo().Grid<SellerViewModel>()
.Name("SellersGrid")
.Columns(columns =>
{
columns.Bound(p => p.SellerId).Hidden();
columns.Bound(p => p.IsSelected);
columns.Bound(e => e.Name);
columns.Bound(e => e.IsActive);
})
.Events(e =>
{
e.DataBound("onHostSellersDataBound");
})
.Filterable()
.Pageable(pager => pager.ButtonCount(3))
.Editable(editable => editable.Mode(GridEditMode.InCell))
.Sortable(sortable => sortable
.AllowUnsort(true)
.SortMode(GridSortMode.MultipleColumn))
.ClientDetailTemplateId("marketplaces_template")
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("GetHostSellers", "CompetitorGroup", new { competitorGroupId = Model.CompetitorGroupId }))
.Sort(sort => sort.Add("IsSelected").Descending())
.PageSize(25)
.Model(model =>
{
model.Id(p => p.UniqueId);
model.Field(p => p.SellerId).Editable(false);
model.Field(p => p.IsSelected).Editable(true);
model.Field(p => p.Name).Editable(false);
model.Field(p => p.IsActive).Editable(false);
})
.ServerOperation(false))
)
<script id="marketplaces_template" type="text/kendo-tmpl">
@(Html.Kendo().TabStrip()
.Name("MarketplacesTabStrip_#=SellerId#")
.SelectedIndex(0)
.Animation(animation => animation.Open(open => open.Fade(FadeDirection.In)))
.Items(items =>
{
items.Add().Text("Marketplaces")
.Content(@<text>
@(Html.Kendo().Grid<SellerViewModel>()
.Name("MarketplacesGrid_#=SellerId#")
.HtmlAttributes(new {style = "height: 543px;"})
.Columns(columns =>
{
columns.Select().Width(50);
columns.Bound(p => p.SellerId).Hidden();
columns.Bound(p => p.HostSellerId).Hidden();
columns.Bound(p => p.IsSelected).Title("Inclus");
columns.Bound(e => e.Name);
columns.Bound(e => e.IsActive);
})
.Events(e =>
{
e.DataBound("onMarketplacesDataBound");
})
.Filterable()
.Editable(editable => editable.Mode(GridEditMode.InCell))
.Scrollable(scrollable => scrollable.Virtual(true))
.Sortable(sortable => sortable
.AllowUnsort(true)
.SortMode(GridSortMode.SingleColumn))
.PersistSelection()
.Pageable(pager =>
{
pager.ButtonCount(3);
pager.Messages(msg => msg.Display("Marketplaces {0} à {1} - sur {2}"));
})
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(500)
.ServerOperation(false)
.Read(read => read.Action("GetMarketplaces", "CompetitorGroup", new {competitorGroupId = Model.CompetitorGroupId, hostSellerId = "#=SellerId#"}))
.Sort(sort => sort.Add("IsSelected").Descending())
.Model(model =>
{
model.Id(p => p.UniqueId);
model.Field(p => p.SellerId).Editable(false);
model.Field(p => p.HostSellerId).Editable(false);
model.Field(p => p.IsSelected).Editable(true);
model.Field(p => p.Name).Editable(false);
model.Field(p => p.IsActive).Editable(false);
})
)
.ToClientTemplate())
</text>);
})
.ToClientTemplate())
</script>