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

[Solved] Nested Grid - Ajax DataSource

1 Answer 222 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jako
Top achievements
Rank 1
Jako asked on 05 Dec 2014, 08:03 AM
Hi there

I have a grid with a child element, I am using AJAX binding for both grids. I have two issues. The child element opens, but doesn't call the AJAX data bind until I click on the header of the child element. And secondly, the #=Publisher# parameter, comes through as #=Publisher# instead of the actual value?

<script id="Top100TitleList" type="text/kendo-tmpl">
    @(Html.Kendo().Grid<TitleListModel>()
            .Name("grid_#=Publisher#")
            .Columns(columns =>
            {
                columns.Bound(c => c.Publisher);
                columns.Bound(c => c.Quantity).Format("{0:n0}").Title("QTY");
                columns.Bound(c => c.Value).Format("R {0:n2}").Title("VAL");
            })
            .DataSource(dataSource => dataSource
                .Ajax()
                .PageSize(100)
                .Read(read => read.Action("VendorTop100", "Dashboard", new { userId = @Model.UserId, salesElement = @Model.SalesElement, rpg = "#=Publisher#" }))
            )
            .Pageable()
            .Sortable()
            .ToClientTemplate()
    )
</script>
 
<div class="row mtm">
    <div class="col-lg-12">
        <h3>Top 10 Vendors</h3>
        <div>
            @(Html.Kendo()
                  .Grid<TitleListModel>()                                 
                  .Name("TopVendorListGrid")
                  .Columns(columns =>
                  {
                      columns.Bound(c => c.Publisher);
                      columns.Bound(c => c.Quantity).Format("{0:n0}").Title("QTY");
                      columns.Bound(c => c.Value).Format("R {0:n2}").Title("VAL");
                  })                                 
                  .ClientDetailTemplateId("Top100TitleList")
                  .DataSource(dataSource => dataSource
                                .Ajax()
                                .Model(model =>
                                    {
                                        model.Id(e => e.Publisher);
                                        model.Field(e => e.Publisher).Editable(false);
                                    }
                                )
                                .PageSize(10)
                                .Read(read => read.Action("VendorTopList", "Dashboard", new { userId = @Model.UserId, salesElement = @Model.SalesElement })))
            )
        </div>
    </div>
</div>

1 Answer, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 09 Dec 2014, 08:31 AM
Hi Jako,

I tried to reproduce the problem locally but to no avail – everything is working as expected on our side. Could you please provide runable project where the issue is reproduced (you can use this example as baseline)? This would help us pinpoint the exact reason for this behavior.

Regards,
Vladimir Iliev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Jako
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Share this question
or