How to add Edit and Delete button for Jq grid for every row

jqgrid, jquery

Solution

I got it, Just take additional column, and add formaater actions as model class. That's it.

  <script >
  $(document).ready(function () {
  jQuery("#jQGridDemo").jqGrid({
  url: 'http://localhost:52618/Sample/GetEmployeeDetails',
  datatype: "json",
  mtype: "POST",
  colNames: ['Eno', 'Ename', 'City', 'Salary','Actions'],
  colModel: [
         { name: 'Eno', index: 'Eno', width: 120, stype: 'text', height: 90, editable: true },
         { name: 'Ename', index: 'Ename', width: 150, editable: true },
         { name: 'City', index: 'City', width: 150, editable: true },
         { name: 'Salary', index: 'Salary', width: 100, height: 120, editable: true },
         {
           name: 'Actions', index: 'Actions', width: 100, height: 120, editable: true, forma  ter: 'actions',
           formatoptions: {
                            keys: true,
                            editformbutton: true
                          }
         }
        ],
        rowNum: 10,
        mtype: 'Get',
        loadonce: true,
        pager: '#jQGridDemoPager',
        viewrecords: true,
        caption: "List Employee Details",
        height: "230px"  
    });
});

Problem

I want to display edit and delete button for every row on jq grid, code as below: ``` $(document).ready(function () { jQuery("#jQGridDemo").jqGrid({ url: 'http://localhost:52618/Sample/GetEmployeeDetails', datatype: "json", mtype: "POST", colNames: ['Eno', 'Ename', 'City', 'Salary'], colModel: [ { name: 'Eno', index: 'Eno', width: 120, stype: 'text', height: 90, editable: true }, { name: 'Ename', index: 'Ename', width: 150, editable: true }, { name: 'City', index: 'City', width: 150, editable: true }, { name: 'Salary', index: 'Salary', width: 100, height: 120, editable: true }, ], rowNum: 10, mtype: 'Get', loadonce: true, pager: '#jQGridDemoPager', viewrecords: true, caption: "List Employee Details", height: "230px", search: true, editable: true }); ``` To display data I have used Json. I am struggling from two days, can anyone help me.

Original source