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

apply sorting on Telerik Gantt view

5 Answers 18 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
soham
Top achievements
Rank 1
soham asked on 30 Nov 2016, 09:58 AM

Hello,

Help me to perform sorting on telerik gantt view columns

5 Answers, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 02 Dec 2016, 07:24 AM
Hi Soham,

Please, check the following example from our SDK Repository that demonstrates how to sort the columns of the GanttView in ascending and descending order:
https://github.com/telerik/xaml-sdk/tree/master/GanttView/GridSorting

Hope this helps.

Regards,
Nasko
Telerik by Progress
Telerik UI for WPF is ready for Visual Studio 2017 RC! Learn more.
0
Alexander
Top achievements
Rank 1
answered on 26 Nov 2020, 03:30 PM

Hello
I used code from SDK Repository and have a  problem: attached behavior is used for all ColumnHeaderContainer in my GanttView. How I need to modify example to perform sorting only by one of columns?

Добрый день, пробовал код из SDK и столкнулся с проблемой: теперь сортировка доступна по всем колонкам GanttView. Как его изменить чтоб сортировка была только для одного толбца?

0
Dilyan Traykov
Telerik team
answered on 30 Nov 2020, 01:25 PM

Hello Alexander,

I've gone ahead and modified the project you referenced to allow sorting for a particular set of columns, specified by a collection property. Please find it attached to my reply.

More specifically, I've introduced a ColumnsToSort property of type ObservableCollection<string> on the ColumnHeaderExtensions class which I then bind to a collection of strings specified in the viewmodel. Lastly, I check whether the clicked ColumnDefinition's MemberBinding is one of the predefined set:

private void OnHeaderMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
		{
			var columnDefinition = this.proxy.DataContext.SourceItem as ColumnDefinition;
			if (columnDefinition != null && GetColumnsToSort(element).Contains(columnDefinition.MemberBinding.Path.Path))
			{
			    // ...
Please have a look and let me know if a similar approach would work for you.

Regards,
Dilyan Traykov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Alexander
Top achievements
Rank 1
answered on 01 Dec 2020, 07:02 AM
Hello Dilyan

Yes your aproach is perfect for me. Thank you ;)
0
Dilyan Traykov
Telerik team
answered on 01 Dec 2020, 12:09 PM

Hello Alexander,

I'm glad to hear the suggested approach works for you. Please let me know if I can further assist you with anything else.

Regards,
Dilyan Traykov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
General Discussions
Asked by
soham
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Alexander
Top achievements
Rank 1
Dilyan Traykov
Telerik team
Share this question
or