ClientTemplate Grid will not display data

3 posts, 0 answers
  1. Martin
    Martin avatar
    15 posts
    Member since:
    Sep 2013

    Posted 16 Apr 2014 Link to this post

    @(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. Martin
    Martin avatar
    15 posts
    Member since:
    Sep 2013

    Posted 16 Apr 2014 in reply to Martin Link to this post

    post vs get was my issue

    fixed
  3. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2310 posts

    Posted 17 Apr 2014 Link to this post

    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.

     
Back to Top