I've found this article: http://www.telerik.com/help/wpf/gridview-filtering-programmatic.html
But column doesn't have "ColumnFilterDescriptor" property. I use 2011.3.1220.40 version of controls.
My problem:
I want to set filters to auto-generated column. I can set filters to grid using "grid.FilterDescriptors" property. It filters data in grid but when I open filter in column header it resets. How to set filters to column?
P.S. My code for adding filter to grid:
But column doesn't have "ColumnFilterDescriptor" property. I use 2011.3.1220.40 version of controls.
My problem:
I want to set filters to auto-generated column. I can set filters to grid using "grid.FilterDescriptors" property. It filters data in grid but when I open filter in column header it resets. How to set filters to column?
P.S. My code for adding filter to grid:
grid.FilterDescriptors[i] =
new
ColumnFilterDescriptor(newColumn)
{
FilterDescriptors = oldColumnDescriptor.FilterDescriptors,
LogicalOperator = oldColumnDescriptor.LogicalOperator,
Column = newColumn
};
5 Answers, 1 is accepted
0
Hello,
Didie
the Telerik team
Indeed, we introduced those changes with the 2012 Q1. As you use an older version, I can suggest you to check the Breaking Changes described in this article where you can see the "Before" code that you can use in your case. Does this help you or do you have any further questions?
Didie
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0
Anton
Top achievements
Rank 1
answered on 16 Jan 2013, 10:30 AM
It helps to understand that I don't know how to solve my initial problem :(
0
Hi,
Attach to RadGridView's AutoGeneratingColumn event and then in the event handler you will have e.Column.ColumnFilterDescriptor which is used for programmatic filtering as described here.
Regards,
Rossen Hristov
the Telerik team
Attach to RadGridView's AutoGeneratingColumn event and then in the event handler you will have e.Column.ColumnFilterDescriptor which is used for programmatic filtering as described here.
Regards,
Rossen Hristov
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0
Anton
Top achievements
Rank 1
answered on 16 Jan 2013, 11:12 AM
e.Column doesn't have ColumnFilterDescriptor in my version of telerik controls, so I create new descriptor and add to grid filters. But it doesn't work as I want.
My problem:
1. User load data from server
2. User filter data locally
3. User load data from server
4. New data should apply to filters but don't replace filters, just renew DistinctFilter values. <- How to realize it?
My problem:
1. User load data from server
2. User filter data locally
3. User load data from server
4. New data should apply to filters but don't replace filters, just renew DistinctFilter values. <- How to realize it?
0
Accepted
Hi,
Actually the DistinctFilter values should be renewed automatically after the source values change.
Still I would suggest you to upgrade.
Regards,
Didie
the Telerik team
Actually the DistinctFilter values should be renewed automatically after the source values change.
With the old version you can add a ColumnFilterDescriptor with a code similar to the following one (for example):
Telerik.Windows.Controls.GridViewColumn nameColumn =
this
.clubsGrid.Columns[0];
ColumnFilterDescriptor nameColumnFilter =
new
ColumnFilterDescriptor((IDataFieldDescriptor)nameColumn);
nameColumnFilter.FieldFilter.Filter1.Operator = FilterOperator.Contains;
nameColumnFilter.FieldFilter.Filter1.Value =
"Ars"
;
clubsGrid.FilterDescriptors.Add(nameColumnFilter);
Still I would suggest you to upgrade.
Regards,
Didie
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.