mleibman/SlickGrid — Issue #258: impossible to use local variables in filter function
Author: timkuijsten
Created: 2011-12-30 23:24:31+00:00
State: open

# Problem
All variables used in a custom filter function (for a DataView) need to be globally defined or the filter function will fail. This has something to do with the compileFilter function in slick.dataview.js.

This is very problematic if all your grid variables are locally defined. For example if you've implemented the grid as a MVC View that can be instantiated multiple times.

# Reproducible
This can be easily seen if the javascript portion of [example-header-row.html](https://github.com/timkuijsten/SlickGrid/blob/localFilterVars/examples/example-header-row.html) is grouped to make it non-global like this:
```(function() {
...
}();
```

# Workaround
Unfortunately my JS skills are currently still too limited to come up with a better solution than duplicating the view 2 times with different global variable names for the grid and columnFilters variables.