Extending a new method to achieve this functionality may be a better way. The code below is the implementation of 'resizeColumn' method that can be used to resize a column programmatically.
$.extend($.fn.datagrid.methods,{
resizeColumn:function(jq,param){
return jq.each(function(){
var dg = $(this);
var col = dg.datagrid('getColumnOption', param.field);
col.boxWidth = param.width + (col.boxWidth-col.width);
col.width = param.width;
dg.datagrid('fixColumnSize', param.field);
})
}
})
For example, to resize the 'itemid' column's size, you can call 'resizeColumn' method. The code looks like this:
$('#mygrid').datagrid('resizeColumn', {
field: 'itemid',
width: 200
});