'Get the updated options for the filter form for the target
resource as JSON.
NB These use a fresh resource, so filter vars are not respected.
s3.filter if respected, so if you need to filter the options, then
can apply filter vars to s3.filter in customise() if the controller
is not the same as the calling one!
GET filter.options
@param r: the S3Request
@param attr: additional controller parameters (ignored currently)'

def _options(self, r, **attr):

    resource = self.resource
    options = {}
    filter_widgets = resource.get_config('filter_widgets', None)
    if filter_widgets:
        fresource = current.s3db.resource(resource.tablename, filter=current.response.s3.filter)
        for widget in filter_widgets:
            if hasattr(widget, 'ajax_options'):
                opts = widget.ajax_options(fresource)
                if (opts and isinstance(opts, dict)):
                    options.update(opts)
    options = json.dumps(options, separators=SEPARATORS)
    current.response.headers['Content-Type'] = 'application/json'
    return options
