10 examples of 'jquery filter table rows by column value' in JavaScript

Every line of 'jquery filter table rows by column value' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
357function filter(table, columnDef) {
358 var filterData = null;
359 table.state.currentFilters.forEach(function (filter) {
360 if (filter.colDef === columnDef) {
361 filterData = filter.filterText;
362 }
363 });
364
365 columnDef.isFiltered = true;
366 table.state.filterInPlace[columnDef.colTag] = false;
367 table.handleColumnFilter.call(null, columnDef, filterData);
368
369 //hide filter dropdown
370 $(this.refs['select-filter-' + columnDef.colTag].getDOMNode()).addClass('rt-hide');
371}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

1160filter(value, field, matchMode) {
1161 if(!this.isFilterBlank(value))
1162 this.filters[field] = {value: value, matchMode: matchMode};
1163 else if(this.filters[field])
1164 delete this.filters[field];
1165
1166 if(this.lazy) {
1167 this.stopFilterPropagation = true;
1168 }
1169
1170 this._filter();
1171}
802function filterColumns(columns, rows) {
803 var filteredColumns = {};
804
805 // Copy columns from "columns" -> "filteredColumns", but only
806 // those columns that are used in the list of rows specified.
807
808 for (var columnUri in columns) {
809 for (var i=0; i<rows.length; ++i) {
810 if (columnUri in rows[i]) {
811 filteredColumns[columnUri] = columns[columnUri];
812 break;
813 }
814 }
815 }
816
817 return filteredColumns;
818}
117public filterData(data, filters: Filter[]) {
118 let d = data.slice();
119
120 filters.forEach((filter) => {
121 d = filter.parseData(d);
122 });
123
124 return d;
125}
198function filtercols(ele) {
199 var val = ele.value.toLowerCase();
200 $("#collections tr").filter(function() {
201 $(this).toggle($(this).text().toLowerCase().indexOf(val) > -1)
202 });
203}
74function add_column(attr,field,filter) {
75 var td = $('<td></td>').append(field);
76 tr.append(td);
77 if (read_only || (pname=='iterations' && attr!='value')) $(field).attr('disabled','true');
78 $(field).on('change',function (event) {
79 var v = event.target.value.trim();
80 if (filter) v = filter(v);
81 module.set_property_attribute(pname,attr,v);
82 });
83}
101private async clearFilter(event: any, column: number): Promise<void> {
102 const parent = event.target.closest('td');
103 const input = parent.getElementsByClassName('au-filter-input')[0];
104 this.removeFiltersForColumn(column);
105 input.value = '';
106 this.filterValues[column] = undefined;
107 const response = await this.onFilter(this.request) as IAuDatatableResponse;
108 this.request.totalRecords = response.totalRecords;
109 this.request.data = response.data;
110 this.reset();
111}
61isFiltered(column: ColumnConfig) {
62 return this.appliedFilters[column.name];
63}
329showValue(col: ParamConfig) {
330 let showValue = false;
331 if (col.uiStyles && col.uiStyles.attributes ) {
332 if (!TableComponentConstants.allowedColumnStylesAlias.includes(col.uiStyles.attributes.alias)) {
333 if (col.uiStyles.attributes.alias === ViewComponent.gridcolumn.toString()) {
334 if (col.uiStyles.attributes.showAsLink !== true) {
335 showValue = true;
336 }
337 }
338 }
339 }
340 return showValue;
341}
47private async selectFilter(event: any, filter: IAuDatatableFilter, column: number): Promise<void> {
48 if (typeof this.onFilter !== 'function') {
49 throw new Error('[au-table-filter:selectFilter] No onFilter() callback has been set');
50 }
51 const value = this.filterValues[column];
52 if (value) {
53 this.removeFiltersForColumn(column);
54 this.request.filters.push({
55 value,
56 description: filter.description,
57 selectedColumn: column,
58 applyToColumns: []
59 });
60 this.setActiveLabelFilter(event);
61 const response = await this.onFilter(this.request) as IAuDatatableResponse;
62 this.request.totalRecords = response.totalRecords;
63 this.request.data = response.data;
64 this.reset();
65 } else {
66 this.showInputWarning(event);
67 }
68}

Related snippets