Web Control FilterAdvanceCtl


Overview

This control is the advanced version of filtering. It supports multiple grouping of conditions. It accepts multiple source objects to select.


The sample code can be found at /ecatalog/check/check_expression.aspx

Properties (cosmetic properties are excluded)

Following are important Properties:

Property Name

Type

Remark

FilterRawData

String

To set the initial data in Json format. 

Owner

TradingAccount

The account owner

AccountID

Int

The account ID





Methods 

Following are important methods:

Method Name

Type

Remark

refresh()


To reload the data/display

Delete(OfflineID)


To find and delete item with particular OfflineID. OfflineID is unique ID for each Item

getRootGroup()

FilterAdvanceGroup

To get the main group (the root)


Events

Following are important methods:

Method Name

Remark

OnNeedDataSource

Use this event to assign data source. Please refer to example.

OnRefresh

This event is called when there’s any update on the conditions


Sample codes

Setup Component

To use this component, following actions are required:


Assign the datasource

To assign datasource, register the event “OnNeedDataSource” at the Page_Load. Following example of source AccountUser and Module as data source. System will display all properties from datasource.

void FilterAdvanceCtl1_OnNeedDataSource(object sender, EventArgs arg)

        {

            List<Type> InputObjects = new List<Type>();

            InputObjects.Add(typeof(AccountUser));

            InputObjects.Add(typeof(Module));


            FilterAdvanceCtl1.InputObjects = InputObjects;

        }


Detect changes

You can use the event onRefresh to detect changes. System will call this event whenever there’s any changes.


void FilterAdvanceCtl1_OnRefreshed(object sender, EventArgs arg)

        {

            // execute code for changes

        }


Evaluate the filters

You can use this webcontrol, to evaluate, which always return true/false. In this example, the component is called, by passing the object LoggedOnUser and Module.


private void getResult()

        {

            string strResult = "";

            try

            {

                bool result = FilterAdvanceCtl1.Evaluate(new List<object>() 

                                 { eCatalogContext.Current.Security.LoggedOnUser, Module });

                strResult = result.ToString();

            }

            catch (Exception ex)

            {

                strResult = ex.Message;

            }

            lblResult.Text = strResult;


        }