You can call the following function to get the first column name.
function getFirstField(dg){
var fields = dg.datagrid('getColumnFields',false).concat(dg.datagrid('getColumnFields'));
for(var i=0; i<fields.length; i++){
var field = fields[i];
var col = dg.datagrid('getColumnOption', field);
if (!col.hidden){
return field;
}
}
}