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

Client Row Template Not Working

5 Answers 306 Views
Grid
This is a migrated thread and some comments may be shown as answers.
raju
Top achievements
Rank 1
raju asked on 19 Jul 2016, 06:21 AM
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>

5 Answers, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 21 Jul 2016, 12:25 PM
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.
0
raju
Top achievements
Rank 1
answered on 22 Jul 2016, 04:30 AM

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.
0
Viktor Tachev
Telerik team
answered on 26 Jul 2016, 11:22 AM
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.
0
raju
Top achievements
Rank 1
answered on 27 Jul 2016, 02:49 AM
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
0
Viktor Tachev
Telerik team
answered on 29 Jul 2016, 11:44 AM
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.
Tags
Grid
Asked by
raju
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
raju
Top achievements
Rank 1
Share this question
or