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

Filter row not working for Client Template

2 Answers 69 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Visvak Prasanth
Top achievements
Rank 1
Veteran
Visvak Prasanth asked on 15 May 2020, 04:35 PM

Hi ,

 

I am using the Filter row in my grid, it works fine if there are no client template. but if there are any client template it gives error.

@(Html.Kendo().Grid<Document>()
                        .SetDefaults()
                        .Name("gridDocuments")
                        .Groupable()
                        .Editable(editable => editable.Mode(GridEditMode.InLine))
                        .Events(x => x.DataBinding("OnDataBound").Edit("EditGrid"))
                        .Columns(columns =>
                        {
                            columns.Bound(x=>x.CategoryCode).Filterable(false).ClientTemplate(#=data.CategoryDescription#").EditorTemplateName("CategoryTypeMultiselect"); 
                            columns.Bound(x => x.AssetTag).Filterable(ftb => ftb.Cell(cell => cell.Operator("contains").SuggestionOperator(FilterType.Contains)));
                            columns.Command(command =>
                            {
                                command.Edit().Text(" ").CancelText(" ").UpdateText(" ");
                                command.Custom("Del").Text("<span class='k-icon k-i-delete'></span>").Click("PageGridDelClicked");
                            }).Width("3%").HtmlAttributes(new { style = "text-align:center;background:#=RowColor#" });
                        })
                        .Selectable(selectable => selectable
                        .Mode(GridSelectionMode.Multiple).Type(GridSelectionType.Cell))
                        .Navigatable()
                        .Filterable(ftb => ftb.Mode(GridFilterMode.Row))
                        .DataSource(dataSource => dataSource
                        .SetDefaults()
                        .PageSize(20)
                        .Model(model =>
                        {
                            model.Id(p => p.Id);
                            model.Field(p => p.AssetTag).Editable(false);
                            model.Field(p => p.CategoryType).Editable(true);
                        })
                        .Read(x => x.Action("GetSelectedData", "Assets", new { CacheKey = PageUID }).Data("getAssetId"))
                        .Update(x => x.Action("UpdateDocuments", "Assets", new { CacheKey = PageUID }).Data("getAssetId"))))

if i enable filter for Categorycode i am getting error.

Please suggest me how to use the Filter row when we have ClientTemplate in the column.

2 Answers, 1 is accepted

Sort by
0
Visvak Prasanth
Top achievements
Rank 1
Veteran
answered on 15 May 2020, 05:00 PM
I have added this post under Filters category .
0
Nikolay
Telerik team
answered on 19 May 2020, 12:29 PM

Hello Visvak Prasanth,

Thank you for sharing the Grid declaration.

In general, the ClientTemplate does not affect the filter functionality. It only adjusts how the field cells to be populated on the client, visually. 

Based on the provided I tried to reproduce this behavior but from my end, no errors were thrown and the filter works just fine. Please fin the project attached to this email. Feel free to modify it to replicate and isolate the problem. Examining this locally will help me fully understand the case and eventually I will be able to provide a fix.

Looking forward to hearing from you.

Regards,


Nikolay
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
General Discussions
Asked by
Visvak Prasanth
Top achievements
Rank 1
Veteran
Answers by
Visvak Prasanth
Top achievements
Rank 1
Veteran
Nikolay
Telerik team
Share this question
or