I am using jqGrid 4.5.4 to build a jqGrid. I have problem in editing combobox.
My combobox has city names.
In combo box there are two cities with same name but different key values. While editing a row in jqgrid dropdown populated with the city of different kay value. I used formatter:'select'
. But it is not working.
My code is as follows ::
var jQuery = $.noConflict();
var lastSel = 0;
jQuery(document).ready(function(){
jQuery.ajax({
// The link we are accessing.
url: <%= "'" +url_1.toString()+"'"%>,
// The type of request.
type: "get",
// The type of data that is getting returned.
dataType: "json"
}).done(function(data){
jQuery("#list2").jqGrid({
url:<%= "'" +url.toString()+"'"%>,
datatype:"json",
mtype:"POST",
colNames:['localityId','City','Locality'],
colModel:[
{
name:'localityId',
index:'localityId',
width:240,
key:true,
editrules:{edithidden:false, required:true},
editable:true,
hidden:true
},
{
name:'cityId',
index:'cityId',
width:240,
editable:true,
edittype:'select',
formatter:'select',
sortable:true,
editrules:{ required:true},
editoptions: {
value: data
}
},
{
name:'locality',
index:'locality',
width:240,
sortable:true,
editable:true,
edittype:'text'
}
],
rowNum:10,
rowList:[10,20,30],
pager: '#pager2',
sortname: 'locality',
editurl:<%= "'" +url_edit.toString()+"'"%>,
viewrecords: true,
multiselect: true,
sortorder: "desc",
caption:"Locality Master"
});
jQuery("#list2").navGrid(
'#pager2',
{add:true, edit:true, del:true},
{},
{},
{},
{}
);
});
});
If formatter='select' is removed then cityId is shown on screen and then if the row is edited then correct city is selected in dropdown. What is the problem with formatter='select' and editoption.