Customizing the FilterBox (FilterScreen) and the List (ResultsGrid) in a ListPage Class

1 minute read time.

In this article I would like to consider the customization of the both the FilterBox (aka FilterScreen) and the List (aka ResultsGrid) used in a ListPage class.

I have written about the use of the ListPage class previously.

Creating a ListPage that can be Used in Multiple Contexts

Mixing the Specialised ListPage class with an EntryGroup

The constructor of the ListPage class makes it very easy to link up a FilterBox with a List, but it may not be immediately obvious how to control the properties of either of these.


using Sage.CRM.WebObject;
 
namespace myProject
{
    public class myClass : ListPage
    {
        public myClass()
            : base("Opportunity", "OpportunityList", "OpportunityFilterBox")
        {
            FilterByField = "oppo_primarycompanyid";
            FilterByContextId = (int)Sage.KeyList.CompanyId;
        }
    }
}

But the List and FilterBox are available within the class.

e.g.


using Sage.CRM.WebObject;
using Sage.CRM.Controls;
 
namespace myProject
{
    public class myClass : ListPage
    {
        public myClass()
            : base("Opportunity", "OpportunityList", "OpportunityFilterBox")
        {
            FilterByField = "oppo_primarycompanyid";
            FilterByContextId = (int)Sage.KeyList.CompanyId;
 
            ResultsGrid.RowsPerScreen = 3;
   
            Entry myEntry = new Entry("oppo_customerref");
            myEntry.NewLine = true;
            FilterScreen.Add(myEntry);
        }
    }
}

  • ResultsGrid contains the current List class used in the ListPage class.
  • FilterScreen contains the EntryGroup class used in the ListPage class.

Note: I changed the code above to reference the Name space Sage.CRM.Controls.

If you use the code snippets in the .NET SDK you will see that the ListPage examples contain a hints that these classes can be used.

  • Jeff, I have a question related to this post: what if the filter panel contained a Selection field, and we wanted to add a value to the selection list. Here's code that I think references the existing field correctly. I can set the default value, and I can remove a lookup item - but I don't see how to add an item,

    EntrySelect job_stageEntry = (EntrySelect)FilterScreen.GetEntry("job_stage");

    job_stageEntry.DefaultValue = jobStage;

    job_stageEntry.RemoveLookup("0");