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

Kendo Grid - In Column.Bound - Client Template passing function with params not working

1 Answer 1429 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bhanu
Top achievements
Rank 1
Bhanu asked on 12 Jul 2018, 02:00 PM

Hi All,

I am working on Telerik Kendo Grid. The scenerio is :

Passing function with parameter in columns.bound client template, but getting the below error

"Uncaught ReferenceError: InvoiceStatus is not defined"

Note : With out giving parameter in the function its working fine.

Please verify the code below :

 <script id="template" type="text/kendo-tmpl">
        @(Html.Kendo().Grid<NH.Accounts.Models.ProviderPaymentMemberLevel>() //<a onclick='alert(\"#: encode(OrderName) #\")' href='\\#'>#= OrderName #</a>  ClientTemplate("#=someFuntion(ExecutionStartDateTime)#");
                                    .Name("grid_#=ProviderId#")
                                    .HtmlAttributes(new { style = "backgroud-color:#27326e " }) //"<a onclick=\"showOrderDetail('#= OrderName #')\" href='\\#'>#= OrderName #</a>"
                                    
                                    .Columns(columns =>
                                     {
                                         //"#if(TotalBalance > 0) {#" + "<span style='padding-right: 10px;'>$ #=TotalBalance#</span><input type='checkbox' 'checked=checked' class='master-pay-checkbox' data-providerid='#=ProviderId#'></input>#}#"
                                         columns.Bound(o => o.InvoiceStatus).Filterable(false).Width(10).ClientTemplate("#= GetInvoiceStatusColor(InvoiceStatus) #").HtmlAttributes(new { style = "text-align: left" });

 

Thanks

Bhanu

1 Answer, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 16 Jul 2018, 09:27 AM
Hello Bhanu,

I have investigated the provided configuration and noticed that the grid is within a template. I assume that this grid is used as a detail template in another parent grid.

Therefore it is necessary to escape the # literals in order to evaluate them in the context of the child grid.

e.g.

columns.Bound(o => o.InvoiceStatus).Filterable(false).Width(10).ClientTemplate("\\#= GetInvoiceStatusColor(InvoiceStatus) \\#").HtmlAttributes(new { style = "text-align: left" });
 

Regards,
Georgi
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Bhanu
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Share this question
or