Pages

Friday, May 5, 2017

How to remove the default filter controls on a ListPane in AX 2012

When you create a ListPage, the kernel automatically adds a FormFilterPaneControl with some filtering options. Many think this can't be removed or hidden, but it can!



It is added during the run method's super() call by the kernel, so using this code on the ListPage you can remove it.  The caveat is if you are using the ListPage FormTemplate, it's not possible because you're not able to override the run method.

The last closing comment I'll add is I don't know if the kernel expects the control to be there later on and if this can cause any issues or not. I just was curious if I could get it to go away.


public void run()
{
    int                 i;
    FormControl         formControl;

    super();
    
    for (i=1; i<=element.design().controlCount(); i++)
    {
        formControl = element.design().controlNum(i);

        if (formControl is FormFilterPaneControl)
        {
            element.design().removeControl(formControl.id());
        }
    }
}


No comments:

Post a Comment