Note that there are some explanatory texts on larger screens.

plurals
  1. PODisplaying Row Contents of JQGrid in MVC4
    primarykey
    data
    text
    <p>I am currently using a JQGrid in an ASP MVC4 Razorview page. The structure of my page is</p> <pre><code>&lt;body onload="TimeStamp();"&gt; &lt;h2&gt;Events as of &lt;div id="timestampDiv"&gt;&lt;/div&gt;&lt;/h2&gt; &lt;div&gt; @Html.Trirand().JQGrid(Model.EventsGrid, "JQGrid1") &lt;/div&gt; &lt;/body&gt; </code></pre> <p>What I would like to do is display the individual elements of a record on the page when a row is clicked in the JQGrid. Think of the Windows Event Viewer, where when you click an event, the rest of the form fills with the specific event information. Ideally, the grid and the record information would be on the same page.</p> <p>My question: I am very new to JQuery and JQGrid. How can I achieve this? Is it possible the way I am thinking about it or is there another, better way to get something similar to what I want?</p> <p>Thank you.</p> <p>UPDATE: I have tried:</p> <pre><code> &lt;script type="text/javascript"&gt; $(document).ready(function () { $("#JQGrid1").jqGrid({ onSelectRow: function (id) { // using id here to get details from server and display them jQuery('#appDiv').text("test"); } }); }); &lt;/script&gt; </code></pre> <p>This causes my grid to disappear from the page.</p> <p>UPDATE2: It seems to me (tell me if I am wrong) that doing the above code rebuilds a jqgrid (like a constructor) and would need more code to work. Since my JQGrid is already created and passed into the view, I must need to setup the onselectrow event handler in the controller. Any ideas?</p>
    singulars
    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. This table or related slice is empty.
    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