Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I had to dig through the documentation a bit to come up with the solution, to see it in its original context go here: <a href="http://www.trirand.com/jqgridwiki/doku.php?id=wiki:retrieving_data" rel="noreferrer">jqGrid Data Manipulation</a>, specifially the section near the end titled "User Data".</p> <p>First, modify your jsonReader implementation as follows:</p> <pre><code> jsonReader: { root: 'Data', page: 'Page', total: 'Total', records: 'Records', userdata : 'Data', repeatitems: false, id: 'Id' } </code></pre> <p>Note the userdata option set to the same as root 'Data'</p> <p>In my case I needed to retrieve the original row data when the user selected a row. I implemented this as follows:</p> <pre><code> onSelectRow: function(rowid) { processRow(rowid); } </code></pre> <p>To retrieve the data within the process row method I have the following:</p> <pre><code>var rowData = $("#resultGrid").getGridParam('userData')[rowId - 1]; </code></pre> <p>Where #resultGrid is a reference to my jqGrid.</p> <p>This will then return the original data bound to that row before any formatting was applied.</p> <p>A couple of points to note:</p> <ol> <li>In my case the grid is paged so the result set is never greater than 10 items therefore the 'userdata' wont grow too large</li> <li>Sorting is performed server side so that index <code>rowId</code> will always return the correct value from 'userData'</li> <li>While 'userdata' as referenced as an option on jsonReader is all lower case, to retrieve it using <code>getGridParam</code> you need to reference it as 'userData'</li> </ol>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload