Skip to content

Can`t clear selected filters #73

@leonardoResendeLima

Description

@leonardoResendeLima

I have a dynamic table with filters on each column.

image

I'm having trouble with a clear button that i'm trying to implement, to clear all filtered data.

The table row with the filters look like this

<tr class="data-grid-filters">
	<td>
		<input type="text" class="form-control input-sm order-search-box" ng-change="gridActions.filter()" ng-model="_id" filter-by="_id" filter-type="text">
	</td>
	<td>
		<input type="text" class="form-control input-sm order-search-box" ng-change="gridActions.filter()" ng-model="reference" filter-by="reference" filter-type="text">
	</td>
	<td>
		<input type="text" class="form-control input-sm order-search-box" ng-change="gridActions.filter()" ng-model="creationDate" filter-by="creationDate" filter-type="text">
	</td>
	<td>
		<i class="fa fa-1x fa-trash" ng-click="clearFilters()" title="{{'DataGrid.ClearFilters' | translate}}"></i>
	</td>
</tr>

First i have tried with Jquery with this function

$scope.clearFilters = function () {
	var inputs = $(".data-grid-filters input");
	$.each(inputs, function (index, value) {
		$(inputs).eq(index)[0].value = "";
	})
}

an then diggin up the public methods of the data-grid

$scope.clearFilters = function () {
	$scope.gridOptions.grid.reloadGrid(false)
}

Need help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions