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

Custom filtering/sorting

5 Answers 879 Views
Grid
This is a migrated thread and some comments may be shown as answers.
mark
Top achievements
Rank 1
Veteran
mark asked on 21 Apr 2020, 07:33 PM

I have two questions. If a column shows icons like countries flags and I want to filter that column on a specific country is it possible for the filter to present a list of available countries and their flags? 

Second question is about the the same column. Let's say I want to sort that column not on a country name but rather on some business logic or on another column's data. Can you explain what a basic approach might be?

 

Thanks

5 Answers, 1 is accepted

Sort by
0
Alex Hajigeorgieva
Telerik team
answered on 23 Apr 2020, 01:56 PM

Hi, Mark,

See the answer to your questions below:

  • Custom Filter UI

If you are referring to the the FilterMenu, then you can initialize your own DropDownList and use its capabilities for templating to show the flag and the country name. 

Filter Menu Customization

DropDownListTemplates

If you are referring to the FilterMultiCheck, then there is the itemTemplate that can be used

  • Custom Sort Order

The data source sort configuration has a compare function that can be used to sort in a custom way:

https://docs.telerik.com/kendo-ui/api/javascript/data/datasource/configuration/sort#sortcompare

Take a look at these resources and let me know in case you need further assistance.

Regards,
Alex Hajigeorgieva
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.
0
mark
Top achievements
Rank 1
Veteran
answered on 23 Apr 2020, 03:50 PM

All my questions are about using your product with Angular. Am I assuming correctly that all of this is available for my Angular development?

Thanks

0
Alex Hajigeorgieva
Telerik team
answered on 23 Apr 2020, 05:37 PM

Hi, Mark,

I am sorry but it did not become apparent that you were inquiring about Kendo UI for Angular, this thread was posted in the jQuery Kendo UI where we have wrappers for Angular 1.x. If you need the answers for these questions regarding the Kendo UI for Angular suite, then we can duplicate the thread and add it to the Angular forum that deals with these questions:

https://www.telerik.com/forums/kendo-angular-ui/grid

Alternatively, you may post there instead, just let me know if you would like me to open a forum thread on your behalf or move this one there.

Kind Regards,
Alex Hajigeorgieva
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.
0
mark
Top achievements
Rank 1
Veteran
answered on 23 Apr 2020, 06:42 PM
Can you please post it to the appropriate forum?


Thanks
0
Svet
Telerik team
answered on 27 Apr 2020, 11:15 AM

Hi Mark,

About the first question, the requirement can be achieved by implementing a custom filter. Please check the following article that demonstrates how to create custom Filter Row and Filter Menu components:

https://www.telerik.com/kendo-angular-ui/components/grid/filtering/reusable-filter/

For example the custom filter component can consist of a MultiSelect component and upon selecting a value for the MultiSelect it can filter the designated column. The [field] property of the column can be bound to strings representing each country, but these strings can be used within the kendoGridCellTemplate to show the respective country flag.

About the second question, the (dataStateChange) or (sortChange) event of the Grid can be handled and if the emitted event object contains a SortDescriptor for the specific column, then it can be manually changed by the developer to target another column or implement any other business logic that will sort the data as desired.

I hope the provided information helps. Please let me know in case any additional information or details are required for this case. Thank you.

Regards,
Svetlin
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
Grid
Asked by
mark
Top achievements
Rank 1
Veteran
Answers by
Alex Hajigeorgieva
Telerik team
mark
Top achievements
Rank 1
Veteran
Svet
Telerik team
Share this question
or