I am working on a manual filtering solution for Janus.GridEx
.
gridEX1.FilterMode = FilterMode.Manual;
We need to query our database everytime that filter changes and we need to do that everytime user types something in filter row so we have :
gridEX1.FilterRowUpdateMode=FilterRowUpdateMode.WhenValueChanges;
To implement manual filtering I have handled ApplyFiltering
event like this :
gridEX1.ApplyingFilter += (sender, e) =>
{
if (gridEX1.RootTable.Columns[gridEX1.Col].Key != "CustomerName") return;
var customerName = gridEX1.GetValue(gridEX1.Col);
gridEX1.SuspendBinding();
bindingSource1.DataSource= string.IsNullOrWhiteSpace(customerName.ToString()) ? _customers : _customers.Where(c => c.CustomerName.Contains(customerName.ToString())).ToList();
gridEX1.ResumeBinding();
};
As you can see I am using GetValue
method because when we set update mode to WhenValueChanges
filter row is not populated.
The problem here is : since RowFilter
is not updated , when the datasource changes grid loads its previous row filter which in turn clears the character that user has already typed.
How I can force GridEx
to fill FilterRow
in WhenValueChanges
mode ?