title: Jqgrid. Locate rowId from key value
body: <p>I've got a basic jqgrid implementation. </p>
  
  <pre><code>$('.fsJqGrid').jqGrid({
      datatype: "local",
      height: 175,
      colNames: ['FeatureId', 'Name', ''],
      colModel: [
          { name: 'FeatureId', index: 'FeatureId', width: 75, align: 'left',
            sorttype: "int", hidden: true, key: true },
          { name: 'Name', index: 'Name', width: 180 },
          { name: 'tools', index: 'tools', width: 150}
      ]
  });
  
  function FeatGridAddRow(jqTableName, feature) {
      ///&lt;summary&gt;Adds a row of data to a Feature JQGrid&lt;/summary&gt;
      var RowId = $("#" + jqTableName).jqGrid('getGridParam', 'reccount');
  
      feature.tools = 'MyToolHtml';
  
      $("#" + jqTableName).jqGrid('addRowData', RowId, feature); //jqgrid
  } //function
  
  function FeatGridUpdateRow(featureId, newName) {
      ///&lt;summary&gt;Updates JQGrid data row&lt;/summary&gt;
  
      //I need to find the rowId, based on the featureId parameter
      var rowId = 0;      
  
      //update grid with new data
      $("#tabFS0").jqGrid('setRowData' , rowId , {Name: newName});
  } //function
  </code></pre>
  
  <p>I want to be able to update a row of data, but need to know the rowId to do so.  </p>
  
  <p>The only data i have is the key value (featureId). </p>
  
  <p>So i'm looking for a way of finding the rowId based on the primary key value which i do know.</p>
  
  <p>I've been looking at the jqgrid documentation, and i'm not seeing an obvious way of doing this.</p>
  
  <hr>
  
  <h2><strong>UPDATE: The answer is to use my table PK as the rowId.</strong></h2>
  
  <p>So, in the add function; </p>
  
  <pre><code>var RowId = $("#" + jqTableName).jqGrid('getGridParam', 'reccount');
  $("#" + jqTableName).jqGrid('addRowData', RowId, feature);
  </code></pre>
  
  <p>becomes</p>
  
  <pre><code>$("#" + jqTableName).jqGrid('addRowData', feature.FeatureId, feature);
  </code></pre>