0

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 ?

Beatles1692
  • 5,214
  • 34
  • 65
  • Can you plan to enforce the new filter in the Data Source instead of relying on GridEx, which is picking up the old value, this would certainly not use GridEx filtering capability, but a workaround, or is it feasible to save new RowFilter separately in a variable and enforcing it on GridEx post loading with the new DataSource, though this will lead to repetitive and redundant call, but may serve the purpose – Mrinal Kamboj Nov 03 '15 at 05:58
  • Check out this too, suggestion is similar to mine, but it talks about canceling event post applying new filter manually http://www.infragistics.com/community/forums/t/16234.aspx – Mrinal Kamboj Nov 03 '15 at 06:03
  • @MrinalKamboj we would like to use the same approach for filtering so that our customers don't have to change their behavior. – Beatles1692 Nov 03 '15 at 06:06

0 Answers0