We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Dynamic Filter - Customize/sort entries in filter list (Starts with, Ends with...)

Thread ID:

Created:

Updated:

Platform:

Replies:

130899 Jun 9,2017 02:57 AM Jun 23,2017 12:15 AM Windows Forms 8
loading
Tags: GridGroupingControl
Oliver Politzki
Asked On June 9, 2017 02:57 AM

Hi there,

is it possible to customize the dynamic filter list? 
I want to show only a small collection of entires and maybe sort them differently, so that 'Equals' is always on top and selected.

See attachment for clarity.

Thanks!

Attachment: dynFilter_2acf43f5.zip

Arulpriya Ramalingam [Syncfusion]
Replied On June 12, 2017 08:36 AM

Hi Oliver, 
 
Thanks for your interst in Syncfusion products. 
 
You can customize the DynamicFilter CompareOperator list by customizing the FilterBarCell model and renderer. The compareOprListBox.Items.AddRange() method can be used to add the compare operator items. Please make use of the below KB link to customize your own FilterCompareOperator list. 
 
 
Regards, 
Arulpriya 


Oliver Politzki
Replied On June 13, 2017 01:36 AM

Hello Arulpriya,

thank you for your answer. 

so do I have to use a CellModel AND a CellRenderer? Isn't there a simpler way to delimit the entires of the filter? :)

Because to me the example code from your post seems a little bit over the top / too much, for what I wanted to achieve. (Only showing a few entires).
I don't want new icons, just using the default ones.

Thank you! 



Oliver Politzki
Replied On June 13, 2017 05:46 AM

So I tried to rebuild your example and ended up with round about eight classes and God knows what else (and it still doesn't work the way I want), just to change the dynamic filter list? Really? 

This doesn't seem right. This can't possibly be the way, right?

This is waaaay too exaggerated. 

Arulpriya Ramalingam [Syncfusion]
Replied On June 14, 2017 04:39 AM

Hi Oliver, 

Thanks for your update. 

Query 
Response 
so do I have to use a CellModel AND a CellRenderer? Isn't there a simpler way to delimit the entires of the filter? :) 
The GridGroupingControl does not have the direct support to add only some CompareOperator to list in DynamicFilter. This can be achieved by only creating the custom CellModel and CellRenderer
just to change the dynamic filter list? Really? 

We have customized the sample as per requirement with some CompareOperator items. The operations done by the CompareOperators should be modified to customize the CompareOperator list. So these are the minimal classes should be added to CustomCellModel and CustomCellRenderer. Please make use of the provided sample. In the provided sample, the order of list can be changed in the list box CompareOperatorListPart of GridTableFilterBarExtCell.cs file as in the below code, 
 
//Add the compare operators in ListBox 
this.compareOprListBox.Items.AddRange(new string[] { "Equals","Expression Match","StartsWith", "EndsWith" }); 
 


 
Regards, 
Arulpriya 


Oliver Politzki
Replied On June 21, 2017 05:14 AM

Hi Arulpriya,

thank you for your help, I got it to work.

There is still one problem, though: 

If I'm typing in the textbox of the filter, the cursor always stays on / jumps to the beginning of the textbox. So if I wanted to insert something in the middle of my input, the cursor will jump to the beginning and my new typed text will be inserted at the end of the textbox.

I saw that the OnKeyPress and OnKeyDown methods are overridden in your example, but I haven't figured out yet, where this "jump to beginning" is happening in the code.

Thanks!


Attachment: CursorBeginning_61a8d9fd.zip

Arulpriya Ramalingam [Syncfusion]
Replied On June 22, 2017 05:56 AM

Hi Oliver, 
 
Thanks for your update. 
 
We have modified the sample as per your requirement. Please refer to the below modified code part in OnKeyPress event of the GridTableFilterBarExtCellRenderer class and make use of the modified sample. 
 
Code snippet 
 
protected override void OnKeyPress(KeyPressEventArgs e) 
{ 
  -----Some codes---- 
int prevSelectionStart = TextBox.SelectionStart; 
string newText = TextBoxText.Remove(TextBox.SelectionStart, TextBox.SelectionLength); 
string s = newText.Insert(TextBox.SelectionStart, (!Char.IsControl(e.KeyChar) ? e.KeyChar.ToString() : string.Empty)); 
s = s.ToUpper(); 
if (this.ValidateString(s)) 
  { 
    if (this.NotifyCurrentCellChanging()) 
    { 
        CurrentCell.IsModified = true; 
        SetTextBoxText(s, true); 
 
        if (charCode != 8 && charCode != 22 && charCode != 0) 
            TextBox.SelectionStart = prevSelectionStart + 1; 
     } 
 } 
  ------Some codes ------ 
} 
 
 
Regards, 
Arulpriya 


Oliver Politzki
Replied On June 22, 2017 08:55 AM

Hello Arulpriya,


thank you, it works!


Arulpriya Ramalingam [Syncfusion]
Replied On June 23, 2017 12:15 AM

Hi Oliver, 
  
Thanks for your update. 
  
We are glad to hear that the provided solution resolved your problem. Please let us know if you need further assistance. 
  
Regards, 
Arulpriya 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;