Customizing filters

Posted by: juano-fp on 8 September 2017, 2:22 pm EST

  • Posted 8 September 2017, 2:22 pm EST

    Hi,

    I'm using Spread for Windows Forms 5 in my application and I would like to modify a few things concerning the filters, but I don't really know how to do it, or even if it is possible... so I hope somebody can give me a hand here!

    1) If the column to be filtered has a large number of different values, the Spread takes quite long to generate the item list when the user clicks on the filter icon. Is there any way to limit dynamically the size of the list? I would like to display the entire list only when there are less than 50 different values in the column, otherwise only the common values (all, blanks, non-blanks, etc) should be displayed.

    2) When a filter is applied, the user cannot see the rest of the existing values in the list anymore. So if he wants to change the filter he must reset it first, and then select the new desired filtering value. How can I make the list to show always all existing values?

    3) I've got a sort and a filter icon in the same cell of the column header, and the sort icon is always displayed on the left of the filter icon. I would like to reverse the order of the icons (filter - left and sort - right)... can this be done?

    Thanks in advance for your help, I appreciate it!

    Regards

  • Replied 8 September 2017, 2:22 pm EST

    Hello,


    In order to customise the dropdown list you can try using GetDropDownFilterItems() and then add or remove the range of items from the list.


    For the second issue reported by you, unfortunately we are unable to replicate the issue at our end with Spread 5.0.2005.2008 as when filtering is being applied the user can still see all the existing values in the dropdown list and there is no need to reset it.


    For the third issue you need to create the custom celltype and use that in the column headers.However, you would need to override the PaintCell method and paint the indicator how you would like to display.


    Hope this will help you. Thanks.

  • Replied 8 September 2017, 2:22 pm EST

    Thank you for your answer.

    Regarding the second issue... I think I mistook the test data, because I have checked it out again and there is definitely nothing wrong with the Spread. Sorry!

    Well now I just need to know one more thing... I'm going to use the GetDropDownFilterItems() method to customize the dropdown list, so I would like to detect when the user clicks on the filter icon to update the list before it is displayed, but I can't find any event to do that. Is it possible to do this?

    Thanks again! Cheers

     

  • Replied 8 September 2017, 2:22 pm EST

    OK, thanks for trying!

    Please let me know as soon as you get something :)

  • Replied 8 September 2017, 2:22 pm EST

    Hi,

    FilterColumnDefinition.ListBehavior determines how the filter list is initialized.  The default behavior uses FilterListBehavior.Default, which is a combination of Blank, NonBlank, and SortAlphabetically, but you can change it to use Custom and define the list using one or more custom filter item classes inheriting from DefaultFilterItem or BaseFilterItem.  The default behavior uses DefaultFilterItem, which includes all unique values in the column and the Blank and NonBlank items in the filter list.  A custom filter item gives you control over how the filtering is performed and how the item is displayed in the list.  There is an example of a custom filter item in the SpreadWinDemo sample form filterAdvanced.  I am afraid there is not any convenient way to replace the filter list or override the UI processing for showing and hiding the filter list or for sorting, or reversing the order of the sort and filter indicators.  It would require implementing a custom cell type and all the code necessary to implement a custom sub editor for the filter list and sorting, which is possible but would require a great deal of coding.

  • Replied 8 September 2017, 2:22 pm EST

    Well this is more complecated than I thought...

    Is there any way to detect when the user clicks on the Filter icon? I mean before the drop-down list is diplayed, so that I can update the custom filter items in the list...

    Thanks again!

  • Replied 8 September 2017, 2:22 pm EST

    Hello,

    I see only Spread's AutoFilteringColumn event fires when you click on the filter icon and the filter is applied. However this doesn't fire until the filtering is applied to the DataModel. I have made a feature request to have an event that fires on filter icon click for our future releases of Spread for Windows Forms.

    Request ID # 99917065

     

    Thanks,

     

  • Replied 8 September 2017, 2:22 pm EST

    Hello Juano,


    I am able to get the customized list in a combobox using GetDropDownFilterItems() and removing the range i don't want but unfortunately i didnt find a way to replace the default dropdown list by our customized list. Need some more time to investigate more on this issue. Will provide you with a workaround if possible.


    Thanks.

  • Replied 8 September 2017, 2:22 pm EST

    Hello,

    This request has been defined as Intended and will not be added to the next maintenance release of Spread for Windows seeing the big change required to make this feature available.

     

    Thanks,

     

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels