Note that there are some explanatory texts on larger screens.

plurals
  1. POJQGrid - how to use inline editing?
    primarykey
    data
    text
    <p>When a user selects a row on the JQGrid, he should be able to edit the editable fields and then press the Enter key which will post the row to the controller method which will update the database. I cannot find how to post the updated data to do this. I want to send the businessUnitId field and the editable fields as parameters to the controller mether to do this. This is my webpage;</p> <pre><code>&lt;%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage&lt;dynamic&gt;" %&gt; &lt;asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"&gt; Maintenance &lt;/asp:Content&gt; &lt;asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"&gt; &lt;fieldset&gt; &lt;legend&gt;Maintenance of Departments and Divisions&lt;/legend&gt; &lt;p&gt;Add, edit or delete a department or division: &lt;%: Html.DropDownList("BusinessUnitTypes")%&gt;&lt;/p&gt; &lt;p&gt;To amend the department or division, select the row, make the change and then press the return key.&lt;/p&gt; &lt;table id="list" class="scroll"&gt;&lt;/table&gt; &lt;div id="pager" class="scroll" style="text-align:center;font-size: 11px;"&gt;&lt;/div&gt; &lt;/fieldset&gt; &lt;!-- "BusinessUnitTypeId", (SelectList)ViewData["BusinessUnitTypes"] --&gt; &lt;script type="text/javascript"&gt; $(document).ready(function () { reloadGrid(); }); $('#BusinessUnitTypes').change(function () { $("#list").trigger("reloadGrid"); }); function reloadGrid() { var lastSelectedId; $('#list').jqGrid({ url: '&lt;%: Url.Action("GetBusinessUnits", "BusinessUnit")%&gt;', postData: { businessUnitTypeId: function () { return $("#BusinessUnitTypes option:selected").val(); } }, datatype: 'json', mtype: 'POST', colNames: ['ID', 'Name', 'Fax', 'Email', "Employees"], colModel: [ { name: 'BusinessUnitId', index: 'BusinessUnitId', width: 25, editable: false }, { name: 'BusinessUnitName', index: 'BusinessUnitName', width: 200, editable: true, edittype: 'text' }, { name: 'Fax', index: 'Fax', width: 80, align: 'right', edittype: 'text', editable: true }, { name: 'Email', index: 'Email', width: 200, editable: true, edittype: 'text' }, { name: 'NumberOfEmployees', index: 'NumberOfEmployees', width: 70, editable: false}], rowNum: 20, rowList: [10, 20, 30], pager: $('#pager'), sortname: 'BusinessUnitName', viewrecords: true, sortorder: "asc", caption: "Edit", height: 575, onSelectRow: function (id) { if (id &amp;&amp; id !== lastSelectedId) { $('#list').restoreRow(lastSelectedId); $('#list').editRow(id, true); lastSelectedId = id; } }, editurl: '&lt;%: Url.Action("Save", "BusinessUnit")%&gt;' }); } &lt;/script&gt; &lt;/asp:Content&gt; </code></pre>
    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. 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