I have a column with an autocomplete st up for inline editing. No problem there. The problem is that the autocomplete has an underlying ID that needs to be set. My thought was to have a hidden column in the grid and use the select callback of the autocomplete to set the ID. All looks good in the callback. But, when it comes time to save the row, the column is empty. Any ideas what is unsetting the row data?
Here is pertinent code:
{ name: 'fieldName', label: 'fieldLabel', index: 'fielindex', width: 300,
sortable: true, editable: true, edittype : 'custom',
editoptions: {
custom_element : someAutoComplete_element,
custom_value : someAutoComplete_value
}
},
{ name:'someID', index:'someID', width: 70, hidden: true, editable: true,
editrules: {edithidden:false}
},
function someAutoComplete_value(elem, op, value) {
if (op == "set") {
$(elem).val(value);
}
return $(elem).val();
}
function someAutoComplete_element,(value, options) {
var $ac = $('<input type="text"/>');
$ac.autocomplete( {
source: function(request, response) {
$.ajax({
// Code to deal with fetching the autocomplete
});
},
select: function(event, ui) {
var newId = ui.item.obj.id;
var rowId = jQuery('#myTable').jqGrid('getGridParam','selrow');
if (rowId) {
var rowData = jQuery('#myTable').getRowData(rowId);
rowData['someID'] = newId;
}
}
}
)
return $ac;
}
Thanks, Scott