user1392853
user1392853

Reputation: 269

Filter a value in dropdown list with value in a column

I have a kendo grid with custom toolbar template, my drop down list have only one float value Now I want filter grid by that value and a column ( not ID) and get greater than or less than. How can I do ( I work with kendo-asp.net-mvc )

Upvotes: 2

Views: 4095

Answers (1)

Alex Costa
Alex Costa

Reputation: 306

If I've understood correctly, you want to filter your grid based on a value from a dropdown.

You can add a handler to your search button click event that fills the grid filters and then filters the grid:

$( function () {
    $( "#btnSearch" ).click( function ( e ) {
        e.preventDefault();

        $filter = new Array();
        $dropdownValue = $( "#YOUR_DROPDOWN_ID" ).val();

        if ( $dropdownValue ) {
            $filter.push( { field: "GRID_FIELD", operator: "gt", value: $dropdownValue } );
            $filter.push( { field: "GRID_FIELD", operator: "lt", value: $dropdownValue } );
        }

        var grid = $( "#Grid" ).data( "kendoGrid" );
        grid.dataSource.filter( $filter );
    } );
} );

Upvotes: 2

Related Questions