# Filter table using Javascript

**URL:** <https://forums.knack.com/t/filter-table-using-javascript/7572>\
**Category:** Ask Developers\
**Created:** [August 23, 2016, 10:14am UTC](https://forums.knack.com/t/filter-table-using-javascript/7572 "2016-08-23T10:14:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DagmarNoom56291](https://avatars.discourse-cdn.com/v4/letter/d/eb8c5e/32.png) [@DagmarNoom56291](https://forums.knack.com/u/DagmarNoom56291)\
**Post date:** [August 23, 2016, 10:14am UTC](https://forums.knack.com/t/filter-table-using-javascript/7572/1 "2016-08-23T10:14:00Z")

</div>

Hi Guys, is there a way to filter a table using Javascript? I want to pass on the filter parameters to Javascript that will execute when the page renders. I have seen that one can manipulate table filters using the API in this article

[http://helpdesk.knackhq.com/support/solutions/articles/5000447623-api-reference-filters-search](http://helpdesk.knackhq.com/support/solutions/articles/5000447623-api-reference-filters-search)

I basically want to do the same thing, but when a table (or report for that matter) renders.

Thanks

---

<div class="post-metadata">

**Author:** ![AntonZhyzh57663](https://avatars.discourse-cdn.com/v4/letter/a/e8c25b/32.png) [@AntonZhyzh57663](https://forums.knack.com/u/AntonZhyzh57663)\
**Post date:** [September 29, 2016, 5:50am UTC](https://forums.knack.com/t/filter-table-using-javascript/7572/2 "2016-09-29T05:50:37Z")

</div>

When I filter a table, Knack adds some elements to the end of the URL. I have a table at this URL

[https://xxxxxxx.knack.com/logistics#asset-master-list-view/](https://xxxxxxx.knack.com/logistics#asset-master-list-view/)

and when I add a filter ("status = working") to the table, the URL becomes:

[https://xxxxxxx.knack.com/logistics#asset-master-list-view/?view\_76\_filters=%7B%22match%22%3A%22and%22%2C%22rules%22%3A%5B%7B%22field%22%3A%22field\_23%22%2C%22operator%22%3A%22is%22%2C%22value%22%3A%22Working%22%2C%22field\_name%22%3A%22Status%22%7D%5D%7D&view\_76\_page=1](https://xxxxxxx.knack.com/logistics#asset-master-list-view/?view_76_filters=%7B%22match%22%3A%22and%22%2C%22rules%22%3A%5B%7B%22field%22%3A%22field_23%22%2C%22operator%22%3A%22is%22%2C%22value%22%3A%22Working%22%2C%22field_name%22%3A%22Status%22%7D%5D%7D&view_76_page=1)

Translating using [http://meyerweb.com/eric/tools/dencoder/](http://meyerweb.com/eric/tools/dencoder/) from the question mark:

?view\_76\_filters={"match":"and","rules":[{"field":"field\_23","operator":"is","value":"Working","field\_name":"Status"}]}&view\_76\_page=1

Which appears to be a similar/identical string to var filters in the API page you mentioned.

Perhaps one way to do this would be to manually filter the table, use the URL to determine what filter properties should exist and use javascript to redirect the user to the "filtered" page (being careful not to get users stuck in a loop, ie check they're not already on a filtered view before redirecting).

This probably wont stop users from un-filtering the table (unless you can hide that control, which should be possible).

Likely it's not a secure way of doing as user can probably freeze the page with all the records before their view becomes filtered.
