Please try to call the 'buildToolbar' function to build the toolbar via javascript code.
function buildToolbar(conf){
var tb = $('<div></div>').appendTo('body');
$.map(conf, function(options){
var type = options.type || 'linkbutton';
var a = $('<a href="#"></a>').appendTo(tb);
a[type]($.extend({}, options, {
plain:true,
onClick: options.onClick||options.handler
}));
});
return tb;
}
$(function(){
var conf = [{
text:'Add',
iconCls:'icon-add',
handler:function(){alert('add')}
},{
text:'Cut',
iconCls:'icon-cut',
handler:function(){alert('cut')}
},{
text:'Save',
iconCls:'icon-save',
type:'menubutton',
menu: '#mm',
handler:function(){alert('save')}
}];
$('#dg').datagrid({
toolbar: buildToolbar(conf)
});
})