View Full Version : Ext.ux.Printer and CheckColumn (or, a Tale of Two Plugins ;)

24 Jun 2010, 12:17 PM
When I use a CheckColumn in a grid, I cannot use the Ext.ux.Printer extensions print capabilities without encountering an error. This is tracable to the following call to the CheckColumn's renderer, from this line in the prepareData method of Ext.ux.Printer.GridPanelRenderer:

convertedData[key] = column.renderer ? column.renderer(value, null, item) : value;The problem is that CheckColumn defines a renderer but it is trying to modify the css attribute of the null being passed as the second parameter from above:

renderer : function(v, p, record){
p.css += ' x-grid3-check-col-td'; //this is the line that is failing
return String.format('<div class="x-grid3-check-col{0} {1}"> </div>', v ? '-on' : '', this.createId());
},So I hacked a solution by introducing a new printValueUnrendered property on CheckColumn's prototype and setting it to true, and then checking for this property with the following replacement line of code in Ext.ux.Printer.GridPanelRenderer's prepareData method:

convertedData[key] = (column.renderer && !column.printValueUnrendered) ? column.renderer(value, null, item) : value;So now it prints the value for CheckColumn, which (in my case only?) is either true or blank, but I've been asked if I can't improve upon this. So its back to possibly overriding CheckColumn's render method, and branching if p==null.

And herein lies a problem unsolved as yet. I'd like to be able to use Firebug to inspect the window/document generated for printing, but it gets closed automatically :( This is verifiable from the following print method of Ext.ux.Printer.BaseRenderer:

print: function(component) {
var name = component && component.getXType
? String.format("print_{0}_{1}", component.getXType(), component.id)
: "print";

var win = window.open('', name);


}Ok, I can temporarily comment out the lines of code that close the document and window so that I can inspect away with Firebug. But I'm wondering, if there might be any interest in making this automatic closing of the document/window be configurable to possibly not happen automatically?