Unable to use blank spaces in Filter

Nov 28, 2011 at 9:21 AM

Hi,
we are using jibgrid in our SharePoint Silverlight project.
Everything is fine, but when I like to use blank spaces in my filter string the pulldown menu opens and I am not able to use two words in the filter string. How can I avoid that?

Coordinator
Nov 29, 2011 at 11:47 PM

I'm having a hard time understanding what you are trying to say.  Could you give me an example of the 'blank spaces' and two word filter. 

Nov 30, 2011 at 1:26 PM

Hi,

I have same problem.

For example: I bind list of processors to JibGrid and wana filter processor name with an expression like 'amd phenom'. But once I type space between two words, 'cbDistinctProperties' toggles and I can't type the next word.

Dec 1, 2011 at 1:16 PM

Thanks @virtual_matador your description is much better. :-)

Coordinator
Dec 2, 2011 at 3:43 AM

Thanks for the clarification. The bug is the result of the filter control implementation. Since the filter TextBox is placed inside Filter ComboBox by overriding the data template, the keydown events are first trapped by the ComoBox. Since the default behavior for the ComboBox is to open the dropdown, it marks the KeyEventArgs as handled and the TextBox never gets the KeyDown. I solved the problem by inheriting from the ComboBox and not sending the spacebar KeyDown to the base class. This results in the TextBox getting the spacebar KeyDown and everything working as expected. Well, I guess that hitting the spacebar will no longer show the dropdown, but we can pass that off as a feature! I've updated the code.

Here is the implementation for the extended combobox.

namespace Jib.Controls.DataGrid
{
    public class FilterDistinctComboBox : ComboBox
    {
        protected override void OnKeyDown(KeyEventArgs e)
        {
            

// Stop "Spacebar" from being eaten by the ComboBox. The filter TextBox needs the KeyDown

if (e.Key != Key.Space) { base.OnKeyDown(e); } } } } All you have to do is replace the existing ComboBox in ColumnFilterControl.xaml to a FilterDistinctComboBox.
Dec 3, 2011 at 7:12 AM

Hi,

Thanks alot.

Jan 19, 2012 at 9:18 AM
Edited Jan 19, 2012 at 9:39 AM

thanks alot