How to: Apply Master Filtering in ASPxDashboardViewer

Note

Starting with v17.1, we recommend using the ASPxDashboard control or a corresponding ASP.NET MVC extension to display dashboards within web applications. Refer to the following KB articles to learn more about migration to ASPxDashboard / ASP.NET MVC Dashboard:

The following example demonstrates how to apply master filtering in ASPxDashboardViewer on the client side.

In this example, the ASPxClientDashboardViewer.SetMasterFilter method is used to select required rows in the Grid dashboard item while the ASPxClientDashboardViewer.SetRange method is called to select the required range in the Range Filter dashboard item. These methods are called in the ASPxClientButton.Click event handler of the ASPxButton1.

Note

Note that in OLAP mode, unique names are used instead of values.

function setMasterFilters() {
    var selectedValues = [['UK', 'Anne Dodsworth'], ['USA', 'Andrew Fuller']];
    var selectedRange = new ASPxClientDashboardRangeFilterSelection();
    selectedRange.Minimum = new Date(95, 1, 1);
    selectedRange.Maximum = new Date(96, 1, 1);

    setMasterFilter('gridDashboardItem1', selectedValues);
    setRange('rangeFilterDashboardItem1', selectedRange);
}

function clearMasterFilters() {
    clearMasterFilter('gridDashboardItem1');
    clearMasterFilter('rangeFilterDashboardItem1');
}

function setMasterFilter(itemName, selectedValues) {
    if (WebViewer.CanSetMasterFilter(itemName)) {
        WebViewer.SetMasterFilter(itemName, selectedValues);
    }
}

function setRange(itemName, selectedRange) {
    WebViewer.SetRange(itemName, selectedRange);
}

function clearMasterFilter(itemName) {
    if (WebViewer.CanClearMasterFilter(itemName)) {
        WebViewer.ClearMasterFilter(itemName);
    }
}

See Also