Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

How to register a custom filter function and use it in GridControl

$
0
0

Starting from version 11.1 it is possible to register a custom function globally .

To create this function, it is necessary to implement the ICustomFunctionOperatorBrowsable interface. If you wish your custom function to be evaluated on the server side (for instance, when Server Mode is used) it is necessary to implement the ICustomFunctionOperatorFormattable interface.
Finally, to register a custom function you should call the CriteriaOperator.RegisterCustomFunction method with your custom function instance at the application startup.

To show a custom function, for instance, within a column DateTime filter dropdown handle the GridView.ShowFilterPopupDate event. In this event handler create a FunctionOperator instance and pass your custom function name to its constructor. Then, add this FunctionOperator to the e.List collection.

Also, it is possible to use a custom function within FilterEditorControl. To use the FilterEditorControl rather than a regular FilterControl in a grid, set the GridView.OptionsFilter.DefaultFilterEditorView property to any value except for Visual. So, you can enter your function in the FilterEditorControl by choosing the Text tab.

This example illustrates how to add a custom function that will determine whether or not a processed date is a day off and show it in a column DateTime filter dropdown.

Question Comments

Added By: Paul Baumgartner at: 12/4/2014 4:10:01 AM    

Does registration have to be at application startup or can it be registered later using the same method? If only at startup, is there a way to manually add the custom function operator to a particular GridControl at point of constructing the GridControl?

Added By: Nadezhda (DevExpress Support) at: 12/4/2014 6:59:11 AM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: How to use a custom filter function in GridControl. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.


Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>