Skip to main content

ASPxClientGridView.ApplyFilter(filterExpression) Method

Applies the specified filter expression to the GridView.

Declaration

ApplyFilter(
    filterExpression: string
): void

Parameters

Name Type Description
filterExpression string

A string value that specifies the filter expression.

Remarks

The ApplyFilter method allows you to provide complex filter criteria. To apply a filter to the specified column, use the ASPxClientGridView.AutoFilterByColumn method. End-users can apply a filter via the Filter Row which is displayed when the ASPxGridViewSettings.ShowFilterRow property is set to true.

Example

The code sample below demonstrates how you can use the ASPxTrackBar control to specify a filter condition for the ASPxGridView control.

Handle the ASPxClientTrackBar.PositionChanging event to update label content that displays the currently selected range. The ASPxClientTrackBar.PositionChanged event handler applies the specified filter to the grid by using the ASPxClientGridView.ApplyFilter method. Note that the ASPxTrackBar.ValueChangedDelay property specifies the time interval between when a user changes the editor’s value and when the filter is applied.

The image below shows the result.

TrackBar_Grid

function initLbRange() {
     lbRange.SetText('$' + tbSale.GetPositionStart() + ',000 - $' + tbSale.GetPositionEnd() + ',000');
     updateGrid();
};

function updateLbRange(s, e) {
     lbRange.SetText('$' + e.newPositionStart + ',000 - $' + e.newPositionEnd + ',000');
};

function updateGrid() {
     var filterCondition = "[Sale] > " + tbSale.GetPositionStart() * 1000 
     + " AND [Sale] < " + tbSale.GetPositionEnd() * 1000;
     grid.ApplyFilter(filterCondition);
};
See Also