title: How to enable disable button on jqGrid row select
body: <p>I have an input button like this:</p>
  
  <pre><code>&lt;input type="button"
         id="deleteDocumentButton"
         value="Delete Document"
         class="btn"
         onclick=""&gt;
  </code></pre>
  
  <p>I want to disable this depending on if the following jqGrid's row is selected:</p>
  
  <pre><code>var encoded = '${JSONList}';
          var elem = document.createElement('textarea');
          elem.innerHTML = encoded;
          var decoded = elem.value;
          var parsed = JSON.parse(decoded);
  
          var values = parsed.values
          jQuery("#existingDocs").jqGrid({
            data: values,
            datatype: "local",
            height: 'auto',
            colNames:['Filename','Description'],
            colModel:[
              {name:'filenameAndPath',index:'filenameAndPath', width:400, sorttype:"string"},
              {name:'description',index:'description', width:400, sorttype:"string"},
            ],
            viewrecords: true,
            caption: "Exisitng User Docs"
           });
  </code></pre>
  
  <p>I have tried this solution but it throws the error: <code>Cannot property of length on undefined()</code>:</p>
  
  <pre><code> var selRow = jQuery("#exisitingDocs").jqGrid('getGridParam', 'selarrow');
       var count = selRow.length;
        if(count &gt;0)
        {
          $('#deleteDocumentButton').prop('disabled', false);
        }
        else{
          $('#deleteDocumentButton').prop('disabled', true);
        }
  </code></pre>
  
  <p>Am I missing some logic or else how do I solve this issue?</p>