parameters: (table,fieldname=None,fieldvalue=None,col_widths='',
                 colnames=None,_id=None,fields='',col_width=80,width=700,height=300)
return_statement: return TAG[''](TABLE(_id=_id),
                         DIV(_id=_id+"_pager"),
                         SCRIPT(script))
docstring: ## Embed a jqGrid plugin
          - ``table`` is the table name
          - ``fieldname``, ``fieldvalue`` are an optional filter (fieldname==fieldvalue)
          - ``_id`` is the "id" of the DIV that contains the jqGrid
          - ``fields`` is a list of columns names to be displayed
          - ``colnames`` is a list of column headers
          - ``col_width`` is the width of each column (default)
          - ``height`` is the height of the jqGrid
          - ``width`` is the width of the jqGrid
docstring_summary: ## Embed a jqGrid plugin
          - ``table`` is the table name
          - ``fieldname``, ``fieldvalue`` are an optional filter (fieldname==fieldvalue)
          - ``_id`` is the "id" of the DIV that contains the jqGrid
          - ``fields`` is a list of columns names to be displayed
          - ``colnames`` is a list of column headers
          - ``col_width`` is the width of each column (default)
          - ``height`` is the height of the jqGrid
          - ``width`` is the width of the jqGrid
docstring_tokens: ## Embed a jqGrid plugin - table is the table name - fieldname fieldvalue are an optional filter ( fieldname == fieldvalue ) - _id is the id of the DIV that contains the jqGrid - fields is a list of columns names to be displayed - colnames is a list of column headers - col_width is the width of each column ( default ) - height is the height of the jqGrid - width is the width of the jqGrid
function: def jqgrid(table,fieldname=None,fieldvalue=None,col_widths='',
                 colnames=None,_id=None,fields='',col_width=80,width=700,height=300):
          """
          ## Embed a jqGrid plugin
          - ``table`` is the table name
          - ``fieldname``, ``fieldvalue`` are an optional filter (fieldname==fieldvalue)
          - ``_id`` is the "id" of the DIV that contains the jqGrid
          - ``fields`` is a list of columns names to be displayed
          - ``colnames`` is a list of column headers
          - ``col_width`` is the width of each column (default)
          - ``height`` is the height of the jqGrid
          - ``width`` is the width of the jqGrid
          """
          from gluon.serializers import json
          _id = 'jqgrid_%s' % table
          if not fields:
              fields = [x.strip() for x in db[table].fields if db[table][x.strip()].readable]
          elif isinstance(fields,str):
              fields = [x.strip() for x in fields.split(',')]
          else:
              fields = fields
          if col_widths:
              col_widths = [x.strip() for x in col_widths.split(',')]
          elif not col_widths:
              col_widths = [col_width for x in fields]
          if not colnames:
              colnames = [(db[table][x].label or x) for x in fields]
          elif isinstance(colnames,str):
              colnames = [x.strip() for x in colnames]
          colmodel = [{'name':x,'index':x, 'width':col_widths[i], 'sortable':True} \
                          for i,x in enumerate(fields)]
          callback = URL('plugin_wiki','jqgrid',
                         vars=dict(tablename=table,
                                   columns=','.join(fields),
                                   fieldname=fieldname or '',
                                   fieldvalue=fieldvalue,
                                   ))
          script="""
  jQuery(document).ready(function(){jQuery("#%(id)s").jqGrid({ url:'%(callback)s', datatype: "json", colNames: %(colnames)s,colModel:%(colmodel)s, rowNum:10, rowList:[20,50,100], pager: '#%(id)s_pager', viewrecords: true,height:%(height)s});jQuery("#%(id)s").jqGrid('navGrid','#%(id)s_pager',{search:true,add:false,edit:false,del:false});jQuery("#%(id)s").setGridWidth(%(width)s,false);});
  """ % dict(callback=callback,colnames=json(colnames),
             colmodel=json(colmodel),id=_id,height=height,width=width)
          return TAG[''](TABLE(_id=_id),
                         DIV(_id=_id+"_pager"),
                         SCRIPT(script))
function_tokens: def jqgrid ( table , fieldname = None , fieldvalue = None , col_widths = '' , colnames = None , _id = None , fields = '' , col_width = 80 , width = 700 , height = 300 ) : from gluon . serializers import json _id = 'jqgrid_%s' % table if not fields : fields = [ x . strip ( ) for x in db [ table ] . fields if db [ table ] [ x . strip ( ) ] . readable ] elif isinstance ( fields , str ) : fields = [ x . strip ( ) for x in fields . split ( ',' ) ] else : fields = fields if col_widths : col_widths = [ x . strip ( ) for x in col_widths . split ( ',' ) ] elif not col_widths : col_widths = [ col_width for x in fields ] if not colnames : colnames = [ ( db [ table ] [ x ] . label or x ) for x in fields ] elif isinstance ( colnames , str ) : colnames = [ x . strip ( ) for x in colnames ] colmodel = [ { 'name' : x , 'index' : x , 'width' : col_widths [ i ] , 'sortable' : True } for i , x in enumerate ( fields ) ] callback = URL ( 'plugin_wiki' , 'jqgrid' , vars = dict ( tablename = table , columns = ',' . join ( fields ) , fieldname = fieldname or '' , fieldvalue = fieldvalue , ) ) script = """
  jQuery(document).ready(function(){jQuery("#%(id)s").jqGrid({ url:'%(callback)s', datatype: "json", colNames: %(colnames)s,colModel:%(colmodel)s, rowNum:10, rowList:[20,50,100], pager: '#%(id)s_pager', viewrecords: true,height:%(height)s});jQuery("#%(id)s").jqGrid('navGrid','#%(id)s_pager',{search:true,add:false,edit:false,del:false});jQuery("#%(id)s").setGridWidth(%(width)s,false);});
  """ % dict ( callback = callback , colnames = json ( colnames ) , colmodel = json ( colmodel ) , id = _id , height = height , width = width ) return TAG [ '' ] ( TABLE ( _id = _id ) , DIV ( _id = _id + "_pager" ) , SCRIPT ( script ) )