'Inject the groupedItems script and bind it to the container
@param widget_id: the widget container DOM ID
@param options: dict with options for the widget
@note: options dict must be JSON-serializable'

@staticmethod
def inject_script(widget_id, options=None):

    s3 = current.response.s3
    scripts = s3.scripts
    appname = current.request.application
    if s3.debug:
        script = ('/%s/static/scripts/S3/s3.ui.groupeditems.js' % appname)
        if (script not in scripts):
            scripts.append(script)
    else:
        script = ('/%s/static/scripts/S3/s3.groupeditems.min.js' % appname)
        if (script not in scripts):
            scripts.append(script)
    if (not options):
        options = {}
    script = ('$("#%(widget_id)s").groupedItems(%(options)s)' % {'widget_id': widget_id, 'options': json.dumps(options)})
    s3.jquery_ready.append(script)
