PDA

View Full Version : Ext.ux.GridPrinter prints hidden fields



taelo
29 Dec 2010, 11:20 AM
I love Ed Spencer's GrindPrinter, but I'd like the ability to tell GridPrinter to not print hidden fields. Is there a way that I can pass the active columnmodel to GridPrinter? I'd like to be able to sort the data, hide fields and arrange the fields before I hit the print button.

Here is his print function:

print: function(grid) {
//We generate an XTemplate here by using 2 intermediary XTemplates - one to create the header,
//the other to create the body (see the escaped {} below)
var columns = grid.getColumnModel().config;

//build a useable array of store data for the XTemplate
var data = [];
grid.store.data.each(function(item) {
var convertedData = [];
//apply renderers from column model
for (var key in item.data) {
var value = item.data[key];

Ext.each(columns, function(column) {
if (column.dataIndex == key) {
convertedData[key] = column.renderer ? column.renderer(value) : value;
}
}, this);
}

data.push(convertedData);
});


I think what I am looking for is something like the following.

Ext.each(columns, function(column) {
if (column.dataIndex == key) {

if (!isHidden(column.dataIndex)){
convertedData[key] = column.renderer ? column.renderer(value) : value;
}

}
}, this);
}