title: django and jqgrid using django-jqgrid
body: <p>I've been having trouble implementing the above jquery plugin with django.</p>
  
  <p>See below for code references.</p>
  
  <p>In the queryset I am using to test, there are 18 rows of data. All that is displayed is the header row (the row with the labels) as well as the bottom pager row, but nothing else.</p>
  
  <p>Also, what is the point of the grid_handler us, since it isn't referenced anywhere? There isn't much in the way of documentation at the jquery-django site.</p>
  
  <p>Inheriting from JqGrid:</p>
  
  <pre><code>class IllustrationLedger(JqGrid):
      all_fields = IllustrationGrid().get_fields()
      rowNum = 10
      queryset = None#IllustrationGrid # could also be a queryset
      fields = [ field[0].name for field in all_fields ] # optional 
      url = None#'/grid/cfg/'
      caption = 'Illustration Ledger' # optional
      colmodel_overrides = {
          'id': { 'editable': False, 'width':10 },
      }
  
      def __init__(self, request, id):
          super(IllustrationLedger, self).__init__()
          self.queryset = IllustrationGrid.objects.filter(illustration=id)
          self.url = '/grid/cfg/{0}/'.format(id)
          #print IllustrationGrid.objects.filter(illustration=id)
  </code></pre>
  
  <p>Views:</p>
  
  <pre><code>def grid_handler(request, ill_id):
      #print request
      grid = IllustrationLedger(request, ill_id)
      return HttpResponse(grid.get_json(request), mimetype="application/json")
  
  def grid_config(request,ill_id):
      #print request
  
      # build a config suitable to pass to jqgrid constructor   
      grid = IllustrationLedger(request, ill_id)
      print grid.get_config()
      return HttpResponse(grid.get_config(), mimetype="application/json")
  </code></pre>
  
  <p>URLS:</p>
  
  <pre><code>url(r'^grid/(?P&lt;ill_id&gt;\d+)/$', 'grid_handler', name='grid_handler'),
  url(r'^grid/cfg/(?P&lt;ill_id&gt;\d+)/$', 'grid_config', name='grid_config'),
  </code></pre>
  
  <p>Javascript:</p>
  
  <pre><code>$(function(){
  $.getJSON("{% url grid_config ill.id %}", function(data){
    data['illustration'] = "{{ ill.id }}";
  
    $("#igrid").jqGrid(data)
              .navGrid('#pager', 
                  {add: false, edit: false, del: false, view: true},
          {}, // edit options
          {}, // add options
          {}, // del options 
          { multipleSearch:true, closeOnEscape:true }, // search options 
          { jqModal:false, closeOnEscape:true} // view options 
          );
      }); 
  });
  </code></pre>
  
  <p>HTML</p>
  
  <pre><code>&lt;table id="igrid"&gt;&lt;tr&gt;&lt;td/&gt;&lt;/tr&gt;&lt;/table&gt; 
  &lt;div id="pager"&gt;&lt;/div&gt;
  </code></pre>