http://www.trirand.com/blog/jqgrid/jqgrid.html
I have a jqgrid with 5 columns, with first column as Actions, in the first column I have 3 buttons as edit, save, cancel. When I'm binding the data list to the jqgrid, I have 2 issues... first the data in the columns in getting misplaced, as the first column has 3 buttons, the data from the column of the list is binding ti the first column of the grid which has actions as column name and all the other column data are getting misplaced
When I click the edit button in the actions column, all the rows in the grid are supporting the inline edit functionality including the actions column, thereby there is no option for clicking save.
My jQuery code:
<script type="text/javascript">
$(function () {
var lastsel;
jQuery("#list").jqGrid({
url: '/Home/GetStudents/',
datatype: 'json',
mtype: 'POST',
colNames: ['Actions', 'StudentID', 'FirstName', 'LastName', 'Email'],
colModel: [
{ name: 'act', index: 'act', width: 75, sortable: false },
{ name: 'StudentID', sortable: false, key: true },
{ name: 'FirstName', key: true },
{ name: 'LastName', sortable: false, key: true },
{ name: 'Email', width: 200, sortable: false, key: true}],
cmTemplate: { align: 'center', editable: true },
pager: '#pager',
width: 750,
rowNum: 15,
rowList: [5, 10, 20, 50],
sortname: 'StudentID',
sortorder: "asc",
viewrecords: true,
caption: ' My First JQgrid',
gridComplete: function () {
var ids = jQuery("#list").jqGrid('getDataIDs');
for (var i = 0; i < ids.length; i++) {
var cl = ids[i];
be = "<input style='height:22px;width:20px;' type='button' value='E' onclick=\"jQuery('#list').editRow('" + cl + "');\" />";
se = "<input style='height:22px;width:20px;' type='button' value='S' onclick=\"jQuery('#list').saveRow('" + cl + "');\" />";
ce = "<input style='height:22px;width:20px;' type='button' value='C' onclick=\"jQuery('#list').restoreRow('" + cl + "');\" />";
jQuery("#list").jqGrid('setRowData', ids[i], { act: be + se + ce });
}
},
editurl: '/Home/About/',
// data: { get_param: selectedDescription },
caption: "jQgrid Sample"
});
jQuery("#list").jqGrid('navGrid', "#prowed2", { edit: false, add: false, del: false });
});
</script>