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

ClientTemplate Grid will not display data

2 Answers 205 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 1
Martin asked on 16 Apr 2014, 07:01 PM
@(Html.Kendo().Grid<McGladrey.DOTT.DataAccess.EngagementStatusDataItem>()
            .Name("grid")
            .Columns(columns =>
            {
                
                columns.Bound(c => c.ClientName).Width("9%").Title("Client Name");
                columns.Bound(c => c.ClientNumber).Width("7%");
                columns.Bound(c => c.TaxYear).Width("7%");
                columns.Bound(c => c.EngType).Width("7%").Title("Eng Type");
                columns.Bound(c => c.MasterClient).Width("7%");
                columns.Bound(c => c.Assembler).Width("7%");
                columns.Bound(c => c.Status).Width("7%");
                columns.Bound(c => c.Amended).Width("9%");
                columns.Bound(c => c.ReturnTypes).Width("10%");
                columns.Bound(c => c.EIMessage).Width(175).Title("Comments");
                columns.Bound(c => c.ToDoUsers).Width("9%").Title("To Do");
                columns.Bound(c => c.eUpdated).Width("10%").Title("Last Updated").ClientTemplate("#= eUpdated ? kendo.toString(kendo.parseDate(eUpdated), 'MM/dd/yyyy') : '' #");
                columns.Bound(c => c.IsInEngagement).Width("10%");
            })
        .HtmlAttributes(new { style = "height: 380px;" })
        .ClientDetailTemplateId("template")
        .Scrollable()
        
        .Sortable()
         
        .Pageable(pageable => pageable
            .Refresh(true)
            .PageSizes(true)
            .ButtonCount(5))
        .Events(events => events
            .DataBound("dataBound")
            .DetailExpand("expand"))
   
)
</div>
 
 
<script id="template" type="text/x-kendo-template">
 
    @(Html.Kendo().Grid<McGladrey.DOTT.DataModel.WorkSiteDOTT.IManWorkspaceSerializeable>()
                .Name("grid_#=eFolderID#")
                .Columns(columns =>
                {
                    columns.Bound(ws => ws.Name).Width(110);
                    columns.Bound(ws => ws.Owner).Width(110);
                    columns.Bound(ws => ws.CreationDate).ClientTemplate("\\#= CreationDate ? kendo.toString(kendo.parseDate(CreationDate), 'MM/dd/yyyy') : '' \\#");
                    columns.Bound(ws => ws.Description).Width(200);
                })
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .Read(read => read
                            .Action("WorksiteRequest", "Admin", new { clientNumber = "#=ClientNumber#", taxYear = "#=TaxYear#", amended = "#=Amended#", engType = "#=EngType#" })
                         )                  
                )
                .Events(events => events.DataBound("dataBinding"))
                .HtmlAttributes(new { style = "height: 180px;" })
                .ToClientTemplate()
        )
 
</script>
 
<script type="text/javascript">
 
    function dataBound() {
        this.expandRow(this.tbody.find("tr.k-master-row").first());
    }
    function dataBinding()
    {
        alert("here");
        
    }
 
    function expand(e) {
        alert("in expand");
    }
 
    $("#ok").bind("click", function (e) {
 
        var dataSource = new kendo.data.DataSource({
            transport: {
                read: {
                    url: "/Admin/EngagmentRequest",
                    dataType: "json",
                    data: {
                        ClientNumber: $('[name=clientNumber]').val(),
                        ClientName: $('[name=clientName]').val(),
                        TaxYear: $('[name=taxYear]').val()
                    }
                }
            }
        });
        dataSource.pageSize(5);
 
        var grid = $("#grid").data("kendoGrid");
        grid.setDataSource(dataSource);
 
    });
</script>

The issue with the above code is the Child Grid ("grid_#=eFolderID#") does not display any data.

The model is correct. This was proven by removing the columns and letting the grid determine them and all columns displayed correctly.
Data is coming back. This was proven via Fiddler. The following request returns data: /Admin/WorksiteRequest?clientNumber=4010574&taxYear=2013&amended=N&engType=Income%20Tax%20Compliance clientNumber=4010574&taxYear=2013&amended=N&engType=Income%20Tax%20Compliance 
{"CreationDate":"\/Date(1382465699000)\/","Description":"...","FolderID":983371,"ID":"!nrtdms:0:!session:XXXXX:!database:XXX:!page:983371:","LastUser":"XXXX XXXX","Name":"XXXXXXXXX","Owner":"XXXXXX","Path":"XXXXXXXXX","WorkspaceID":XXXXXXX}

The above code will also hit any events I tag on to it. The child grid will hit DataBound and DataBinding events

Everything is there it just will not display the data. 
 
Thoughts?


Thanks,
Martin

2 Answers, 1 is accepted

Sort by
0
Martin
Top achievements
Rank 1
answered on 16 Apr 2014, 10:07 PM
post vs get was my issue

fixed
0
Dimiter Madjarov
Telerik team
answered on 17 Apr 2014, 06:03 AM
Hello Martin,


I am glad that the issue is resolved. Do not hesitate to contact us again if further problems arise.

Have a great day!

Regards,
Dimiter Madjarov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Martin
Top achievements
Rank 1
Answers by
Martin
Top achievements
Rank 1
Dimiter Madjarov
Telerik team
Share this question
or