I was trying to implement drop down in JQGrid. I was using 'select' formatter and it was working fine. But after selection of value and after saved, the data was not showing. Then i read this. I am working with MVC. Here is the code,
{
name: 'Sample',
index: 'Sample',
width: 200,
sortable: true,
align: 'center',
editable: true,
cellEdit: true,
edittype: 'select',
editoptions: {
dataUrl: "/mutation/GetSampleData",
buildSelect: OwnershipTransfer.getAllSelectOptions
}
here is ajaxSelectOptions
ajaxSelectOptions: {
type: "GET",
contentType: 'application/json; charset=utf-8',
dataType: "json",
cache: false,
},
Here is getAllSelectOptions:
var getAllSelectOptions = function (data) {
debugger;
var html = '<select>', d = data.d, length = d.length, i = 0, item;
for (; i < length; i++) {
item = d[i];
html += '<option value=' + item + '>' + item + '</option>';
}
html += '</select>';
return html;
}
Here is my method which returns the data,
[HttpGet]
public ActionResult GetSampleData()
{
var list = ShamilatConstants.GetAll();
return Json(list,JsonRequestBehavior.AllowGet);
}
The problem is when i edit the row, This method hit. I debugged it. But dropdown is not populated. In console there is a 500 internal server error. What is the problem?