The requested page is not available for the requested platform. You are viewing the content for Default platform.

ASPxClientCardView.ApplyFilter(filterExpression) Method

Applies the specified filter expression to the grid.

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.

Examples

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

The ASPxClientTrackBar.PositionChanging event is handled 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 ASPxClientCardView.ApplyFilter method. Note that the ASPxTrackBar.ValueChangedDelay property specifies the time interval between an end-user completing the change to the editor's value, and when the filter is applied.

<script type="text/javascript">
    function initLbRange() {
        lbRange.SetText('$' + tbSale.GetPositionStart() + '-' + tbSale.GetPositionEnd());
        updateGrid();
    };

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

    function updateGrid() {
        var filterCondition = "[ProductSales] > " + tbSale.GetPositionStart() 
        + " AND [ProductSales] < " + tbSale.GetPositionEnd();
        grid.ApplyFilter(filterCondition);
    };
</script>
...
<dx:ASPxCardView ClientInstanceName="grid" ID="ASPxCardView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1">
    <Columns>
        <dx:CardViewTextColumn FieldName="CategoryName" VisibleIndex="0">
        </dx:CardViewTextColumn>
        <dx:CardViewTextColumn FieldName="ProductName" VisibleIndex="1">
        </dx:CardViewTextColumn>
        <dx:CardViewTextColumn FieldName="ProductSales" ReadOnly="True" VisibleIndex="2">
        </dx:CardViewTextColumn>
        <dx:CardViewDateColumn FieldName="ShippedDate" VisibleIndex="3">
        </dx:CardViewDateColumn>
    </Columns>
</dx:ASPxCardView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=|DataDirectory|\nwind.mdb;Persist Security Info=True" ProviderName="System.Data.OleDb" SelectCommand="SELECT [CategoryName], 
[ProductName], [ProductSales], [ShippedDate] FROM [ProductReports]"></asp:SqlDataSource>

<dx:ASPxTrackBar ID="TbSale" runat="server" AllowRangeSelection="True" 
     LargeTickInterval="50" MaxValue="500" MinValue="10" PositionEnd="500" 
     PositionStart="50" ScalePosition="LeftOrTop" Step="10" 
     ClientInstanceName="tbSale" LargeTickEndValue="500" LargeTickStartValue="20" 
     ValueChangedDelay="1000" ValueToolTipPosition="None" Width="300px">
     <ClientSideEvents Init="initLbRange" PositionChanging="updateLbRange" 
     PositionChanged="updateGrid" />
</dx:ASPxTrackBar>

<dx:ASPxLabel ID="LbRange" runat="server" Text="" ClientInstanceName="lbRange">
</dx:ASPxLabel>
See Also