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

Filter Grid Column with Custom Editor

1 Answer 127 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sunny
Top achievements
Rank 1
Sunny asked on 26 Feb 2018, 12:53 AM

In demo:

https://demos.telerik.com/aspnet-mvc/grid/editing-custom

we can see column with datatype CategoryViewModel.

Can we make a filter like demo in link below with that?

https://demos.telerik.com/aspnet-mvc/grid/filter-menu-customization

 

Thanks

 

1 Answer, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 27 Feb 2018, 03:03 PM
Hello Sunny,

Generally speaking the DataSource supports flat data which is why some of the functionality such as sorting, filtering, etc. does not work with nested objects.

As a workaround I can suggest to bind the column to one of the fields of the object (CategoryName). However, since the column is bound to a property of the object it will be necessary to update the object field of the data item manually within the change event of the drop down:

function onChange() {
       $("#grid").data("kendoGrid").dataItem(this.element.closest("tr")).set("Category", this.dataItem().toJSON());
   }

Finally, in order to create the drop down filter widget follow the steps from the demo:

1. Specify which function builds the custom filter widget:

.Filterable(x=> x.UI("customFilter"))

2. Add the function that creates the filter widget:

function customFilter(element) {
        element.kendoDropDownList({
            dataSource: {
                data: data
            },
            optionLabel: "--Select Value--"
        });
    }

For your convenience attached you will find a sample which demonstrates how to use a drop down editor and a drop down filter widget. Please examine it and let me know if it helps you.

I look forward to your reply.


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
Sunny
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Share this question
or