Client Row Template Not Working

6 posts, 0 answers
  1. raju
    raju avatar
    4 posts
    Member since:
    Feb 2015

    Posted 19 Jul Link to this post

    Using below code "kendo ui grid groupable" feature is working fine if not using "ClientRowTemplate", but if I enable the ClientRowTemplate the groupable feature working weirdly, I mean the expand/collapse grouped rows feature stops working in this case.

    Please help me on this.

    Thanks in advance

    <div class="demo-section kendo-grid-override">
    @(Html.Kendo().Grid<PM.Entities.Model.sp_Sel_WorkOrder_Result>()
        .Name("Grid")
        .Columns(columns =>
        {
        columns.Template(@<text></text>).HeaderTemplate("<input type='checkbox' id='chkOrderAll' title='Select all to Archive' />").Width(35);
            columns.Bound(p => p.WorkOrderNo).Title("Order").Filterable(e => e.Extra(true)).Width(90);
            columns.Bound(p => p.OrderDate).Title("Order Date").Filterable(e => e
            .UI("customDatePicker")
            .Extra(true)
            .Operators(opt => opt.ForDate(dt => dt
                    .IsGreaterThan("Greater Than")
                    .IsGreaterThanOrEqualTo("Greater Than Or Equal To")
                    .IsLessThan("Less Than")
                    .IsLessThanOrEqualTo("Less Than Or Equal To")
                ))).Width(120);
            columns.Bound(p => p.CustomerName).Title("Customer").Filterable(e => e.Extra(false)).Width(180);
            columns.Bound(p => p.ParnterName).Title("Partner").Filterable(e => e.Extra(false)).Width(120);
            columns.Bound(p => p.OrderStatus).Title("Order Status").Filterable(e => e
                .UI("orderStatusFilter")
                .Extra(false)
            ).Width(120);
            columns.Bound(p => p.TelcoApprovalStatus).Title("Status Details").Filterable(false).Width(200);
            columns.Bound(clm => clm.Id).Title("Actions").Filterable(false).Sortable(false).Width(200);
        })
        //.ClientRowTemplate(Html.Partial("Order/_OrderTabs").ToHtmlString())
        .DataSource(ds => ds
            .Ajax()
            .Read(read => read.Action("GetAppWorkOrders", "WorkOrder").Data("window.pm.order.filterWorkOrders"))
            .PageSize(PageSize)
        )
        .AutoBind(false)
        .Events(e => e.DataBound("window.pm.order.onDataBound"))
        .Pageable(page => page.PageSizes(PageSizes).Messages(msg => msg.Display("{0} - {1} of {2:n0} items")))
        .Groupable()
        .Scrollable(a => a.Height("auto"))
        .Sortable(s => s.SortMode(GridSortMode.MultipleColumn))
        .Resizable(e => e.Columns(true))
        .Reorderable(reorder => reorder.Columns(true))
        .Filterable(filterable => filterable
            .Operators(operators => operators
                .ForString(str => str.Clear()
                    .Contains("Contains")
                    .DoesNotContain("Not contains")
                    .StartsWith("Starts with")
                    .EndsWith("Ends with")
                )
            )
        )
         .NoRecords(NoRecordFound)
    )
    </div>
  2. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 21 Jul Link to this post

    Hello Raju,

    Please examine the following threads that illustrate how you can use grouping in the Grid with ClientRowTemplate. Give the approach a try and see how it works for you.



    Regards,
    Viktor Tachev
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. raju
    raju avatar
    4 posts
    Member since:
    Feb 2015

    Posted 21 Jul in reply to Viktor Tachev Link to this post

    Thanks a lot Viktor

    It worked for me but "only for the first when I drop the column in column group header" and I guess it is because, "I am using the partial view" for client row template and rightly so otherwise the code will become very lengthy and difficult to manage in our case.

    So what I did before your reply, I handled the same logic which you suggested in your reply using the kendo grid's "OnDatabound" event and added the "<td class="k-group-cell"></td>".

    A quick question : If we use partial view as a client row template, will kendo call that partial view for each read request to make row template again or it just call it for the first time(on page load) and use it as row template?

    But thanks a lot once again Viktor.
  5. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 26 Jul Link to this post

    Hi Raju,

    A parial view will be rendered as many times as it is defined in the parent view. Similarly the code in the partial view will be executed multiple times.

    Please examine the following threads that elaborate in more detail on using partial views:



    Regards,
    Viktor Tachev
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  6. raju
    raju avatar
    4 posts
    Member since:
    Feb 2015

    Posted 26 Jul in reply to Viktor Tachev Link to this post

    Hi Viktor

    Thanks for your reply, you are absolutely right about the concept of parent view and partial view in mvc. But my question was regarding the ajax read request of kendo grid like (on page change, on filter, on sorting, on grouping). So in that case, "Will kendo grid reload the partial view or not?"

    Thanks

    Raju
  7. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 29 Jul Link to this post

    Hello Raju,


    The code in the partial view will be executed every time the view is defined. If the PartialView is used as a row in the grid and is called multiple times then the code in it will be executed on each call.


    Regards,
    Viktor Tachev
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017