In my grid I'm using custom formatter to edit one of its column field values.
I want set the focus to that editable field on selecting the row of the grid.
please help me on this...
This is my grid
jQuery("#myGrid").jqGrid({
datatype: "local",
colNames:['','','',''],
colModel:[{name:'id',index:'id', width:50, hidden:true},
{name:'activname',index:'activname', width:100, title: false},
{name:'formattedvalue',index:'formattedvalue', width:200, formatter:formatField},
{name:'value',index:'value', hidden:true}],
height: window.innerHeight - 318,
onSelectRow: function(id,stat,e)
{
// here I want to set the focus to the editable field
}});
and This is the formatter function
function formatField(cellvalue, options, rowObject){
jQuery("myGrid").jqGrid('setColProp','formattedvalue',
{editable: true,
edittype:"custom",
editoptions: {
custom_element: function(value, options) {
var elemStr = '<div><input type="text" id="'+ options.id +'_id" tabindex="2" maxlength="10" size="10" value="' + value + '" /> </div>';
var $custElem = jQuery(elemStr);
$custElem.find("input").bind("keydown",function(e) {
return dynamicFieldKeyPressed(e, this, rowObject);
});
return $custElem[0];
},
custom_value: function(elem, operation, value){
return jQuery(elem).find("input").val();
}
}
});
return cellvalue;}