I am trying to help myself

I've modified an old piece of code by stworty, I think, and made this:
$.extend($.fn.datagrid.methods, {
toHtml: function(jq, style){
return jq.each(function(){
var format = function (s, c) { return s.replace(/{(\w+)}/g, function (m, p) { return c[p]; }) }
var template= '<html ><head><style>{style}</style></head><body><table >{table}</table></body></html>'
var alink = $('<a style="display:none"></a>').appendTo('body');
var view = $(this).datagrid('getPanel').find('div.datagrid-view');
var table = view.find('div.datagrid-view2 table.datagrid-btable').clone();
var theader = view.find('.datagrid-header-row').clone();
var tbody = table.find('>tbody');
table.prepend(theader);
view.find('div.datagrid-view1 table.datagrid-btable>tbody>tr').each(function(index){
$(this).clone().children().prependTo(tbody.children('tr:eq('+index+')'));
});
var style =style || " table {border:1px solid #aaa; } td {white-space: nowrap;border:1px solid #ddd; font-family:Tahoma;} .datagrid-header-row { background-color:#eee; } "
var lista = { style:style,table: table.html() }
var dd =format(template, lista)
var w = window.open('');
w.document.write(dd);
})
}
});
this maintains the features of every cell (colors, formats, column order, hidden columns)
BUT
if using data grid-scrollview and the table is long,it sports only the current page, so I am missing something...
RIc