0
votes

I've got a grid that uses a client template to show another grid. The 'master-grid' points to the template tag with:

.ClientDetailTemplateId("template")

and template markup contains the following grid:

@(Html.Kendo().Grid<SHFTavling_3.Data.bo_Hall>()
.Name("grid2")
.DataSource(dataSource =>
        {
            dataSource.Ajax().Read(read =>
            {
                read.Action("GetClubArenas", "Club", new { ClubId = "#=ClubId#" });
            });
            dataSource.Ajax().Events(e => e.Error("onError"));
        }
            ).Columns(c =>
            {
                c.Bound(x => x.HallId).HtmlAttributes(new { @class = "arena-id" }).Hidden();
                c.Bound(x => x.HallAlias);
                c.Bound(x => x.HallMinis);
                c.Bound(x => x.HallMeasurement);
                c.Bound(x => x.HallCapacity);
                c.Bound(x => x).Title("Ta bort").ClientTemplate("<span class='k-icon delete-arena k-i-cancel' onClick='deleteArena(this, #=ClubId#)'></span>");

            })
            .Sortable().ToClientTemplate()
)

at this point, only the first expanded row will be populated with the most recently expanded row. E.g. If row one is expanded first, and I expand row three, row one will get the data for row three and row three remains empty.

To slove this, I changed

.Name("grid2")

to

.Name("grid2_#=ClubId#")

to make each grid in the template unique, so the data can find the correct grid.

My problem now is that I get no errors and can't move forward.

The controller mentioned does not hit in debug mode, and the ajax call for grid2 to populate the grid isn't even made - and I don't understand why.

No JS errors are thrown in the browser console, no obvious errors at all.

As of this

dataSource.Ajax().Events(e => e.Error("onError"));

error handling on the datasource, it doesn't call it either.

1

1 Answers

1
votes

Turned out that every "ClubId" contained spaces. I just had to trim the ids before sending it to the view.

I hope this is error handled in the future.