'Method to Ajax-retrieve the current options of this widget
@param resource: the S3Resource'

def ajax_options(self, resource):

    opts = self.opts
    attr = self._attr(resource)
    (ftype, options, noopt) = self._options(resource)
    if (options is None):
        options = {attr['_id']: {'empty': str(noopt)}}
    else:
        cols = opts.get('cols', None)
        if cols:
            widget = S3GroupedOptionsWidget(options=options, multiple=True, cols=cols, size=(opts['size'] or 12), help_field=opts['help_field'], sort=opts.get('sort', True))
            options = {attr['_id']: widget._options({'type': ftype}, [])}
        else:
            options = {attr['_id']: [(k, s3_unicode(v)) for (k, v) in options]}
    return options
