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

MulticolumnCombobox with column filter

3 Answers 541 Views
MultiColumn ComboBox
This is a migrated thread and some comments may be shown as answers.
Bob
Top achievements
Rank 1
Bob asked on 01 Feb 2020, 04:11 PM

Hi

i use link bellow to produce custom filtering in MulticolumnCombobox  and it work well

https://www.telerik.com/support/kb/winforms/details/use-custom-filtering-to-search-in-radmulticolumncombobox

but i want have filtering row in in grid too. what can i do to achieve this?

when i enabe and ShowFilterRow in grid and try to filter in filter row nothing happen and the popup close. could you please give me a c# sample

code to achive both filter by row filter and filter by all columns?

thanks

3 Answers, 1 is accepted

Sort by
0
Nadya | Tech Support Engineer
Telerik team
answered on 04 Feb 2020, 02:05 PM

Hello Bob,

First, I would like to note that by default RadMultiColumnComboBox is intended to filter via the text box above the grid. It is possible to show the filtering row as in grid but if you want to allow filtering you should subscribe to several events in order to stop the pop up from closing. Please refer to the following code snippet and keep in mind that this is just an alternative filtering approach:

this.radMultiColumnComboBox1.AutoFilter = true;
this.radMultiColumnComboBox1.EditorControl.ShowFilteringRow = true;
this.radMultiColumnComboBox1.EditorControl.MouseLeave += this.EditorControl_MouseLeave;
this.radMultiColumnComboBox1.DropDownClosing += this.RadMultiColumnComboBox1_DropDownClosing;
this.radMultiColumnComboBox1.EditorControl.CellClick += this.EditorControl_CellClick;

 bool shouldNotCancelPopup = true;
 private void EditorControl_CellClick(object sender, GridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0)
     {
         shouldNotCancelPopup = false;
     }
     else
     {
         shouldNotCancelPopup = true;
     }
 }

 private void RadMultiColumnComboBox1_DropDownClosing(object sender, RadPopupClosingEventArgs args)
 {
     if (shouldNotCancelPopup)
     {
         args.Cancel = true;
     }
 }

 private void EditorControl_MouseLeave(object sender, EventArgs e)
 {
     shouldNotCancelPopup = false;
 }

The achieved result following this approach is demonstrated in the attached gif file. 

RadMultiColumnComboBox supports one type of filtering at a time. If you choose to use custom filtering this means that any other filtering like basic filtering or like the suggested here approach should not be applied. When EnableCustomFiltering is true, only the logic in the CustomFiltering event is considered. It is up to you to choose which type of filtering to follow in your project. As a suggestion to your custom requirement, I can offer to check which element gets the focus and apply filter accordingly. If the focus is in the editable area you can apply the custom filtering that you have, if the focus is in the pop up apply the suggested here approach.

I hope this helps. Should you have any other questions, I will be glad to help.

Regards,
Nadya
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Bob
Top achievements
Rank 1
answered on 13 Feb 2020, 05:47 AM

Hi

Thanks for reply

you said

"I can offer to check which element gets the focus and apply filter
accordingly. If the focus is in the editable area you can apply the
custom filtering that you have, if the focus is in the pop up apply the
suggested here approach."

i can not detect when the editable area focused  and also for popup.could you plaese show me what events must be consider to achieve the result?

when focus in on editable area the customer filtering apply and when popup or the grid focus i use the filtering cell of each column.

Thanks in advanced

0
Nadya | Tech Support Engineer
Telerik team
answered on 17 Feb 2020, 02:23 PM

Hello Bob,

By handling the GotFocus event of the TextBoxItem that is hosted in the editable area of the RadMultiColumnComboBox you can set EnableCustomFiltering to true and force firing the CustomFiltering event as well. Thus, you will ensure that your custom filtering should be applied. On the other hand, by handling the CurrentRowChanging you can do the opposite and apply the default filtering in the grid. In order to mix these two different approaches for filtering in RadMultiColumnComboBox, I modified previously provided code snippet. For your convenience, I have attached my sample project to this thread. Could you please see how it works for you? Note that following this approach when you select an item from the grid it will automatically appear in the text box area. This comes from default RadMultiColumnComboBox functionality.

If you want to avoid this I can suggest another different approach to use RadPopupEditor and host a grid in the popup container. In this situation, you will have no default filtering logic that is implemented in RadMultiColumnComboBox.

I hope this helps. Let me know if you have additional questions.

Regards,
Nadya
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
MultiColumn ComboBox
Asked by
Bob
Top achievements
Rank 1
Answers by
Nadya | Tech Support Engineer
Telerik team
Bob
Top achievements
Rank 1
Share this question
or