Note that there are some explanatory texts on larger screens.

plurals
  1. POEditable JQGrid with custom functionality
    primarykey
    data
    text
    <p>I am quite new with Jqrid,Although stackoverflow threads about Jqgrid is very good, but I have some question.</p> <p>1-I want a grid with editable columns with add,edit,delete,cancel functionality.</p> <p>2-after that I need some events binding on Like : row selected events to load its child<br> records.</p> <p>3-then when I click submit then save the records with the whole Page Like I have other details of my entity also.</p> <p>for this I did something,search on the different solution,but I couldn't make it so far.</p> <p><strong>Here is my little effort :)</strong></p> <pre><code>function JSMethod() { var grid = $("#table"); var ids = grid.getDataIDs(); for (var i = 0; i &lt; ids.length; i++) { grid.editRow(ids[i], true); }; } $.ajax({ type: "GET", url: '&lt;%= ResolveClientUrl("~/WebService.asmx/GetLookup") %&gt;', dataType: "text", success: function (result) { alert('Success'); lookup = result; }, async: false }); $(function () { var lookup = ""; $("#table").jqGrid({ datatype: function (pdata) { getData(pdata); }, height: 250, editurl: 'default.aspx', gridview: true, colNames: ['ID', 'First Name', 'Last Name', 'Buttons'], colModel: [ { name: 'ID', width: 60, sortable: false, hidden: true }, { name: 'FirstName', width: 200, sortable: false }, { name: 'LastName', width: 200, sortable: false, editable: true, edittype: 'select', stype: 'select', formatter: 'select', editoptions: { value:GetData, size: 30, maxlength: 20} }, { name: 'Buttons', width: 200, sortable: false } ], onSelectRow: function (rowId) { if (rowId &amp;&amp; rowId !== lastRowId) { if (lastRowId != null) { var a = $('#list').saveRow(lastRowId, false, 'clientArray'); changedRows[lastRowId] = $('#list').getRowData(lastRowId); } jQuery('#list').editRow(rowId, true); } lastRowId = rowId; }, imgpath: '&lt;%= ResolveClientUrl("~/styles/redmon/images") %&gt;', caption: "Sample JSON data retrieved from ASMX web services" }); }); function getData(pData) { $.ajax({ type: 'POST', contentType: "application/json; charset=utf-8", url: '&lt;%= ResolveClientUrl("~/WebService.asmx/GetListOfPersons") %&gt;', data: '{}', dataType: "json", success: function (data, textStatus) { if (textStatus == "success") ReceivedClientData(JSON.parse(getMain(data)).rows); }, error: function (data, textStatus) { alert('An error has occured retrieving data!'); } }); } function ReceivedClientData(data) { var thegrid = $("#table"); thegrid.clearGridData(); for (var i = 0; i &lt; data.length; i++) thegrid.addRowData(i + 1, data[i]); } function getMain(dObj) { if (dObj.hasOwnProperty('d')) return dObj.d; else return dObj; } </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.
 

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