Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improvements in printing #2

Merged
merged 2 commits into from May 16, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 10 additions & 1 deletion ux/grid/Printer.js
Expand Up @@ -72,6 +72,15 @@ Ext.define("Ext.ux.grid.Printer", {

data.push(convertedData);
});

//remove columns that do not contains dataIndex or dataIndex is empty. for example: columns filter or columns button
var clearColumns = [];
Ext.each(columns, function (column) {
if (column.dataIndex != "" && !column.hidden) {
clearColumns.push(column);
}
});
columns = clearColumns;

//use the headerTpl and bodyTpl markups to create the main XTemplate below
var headings = Ext.create('Ext.XTemplate', this.headerTpl).apply(columns);
Expand Down Expand Up @@ -105,7 +114,7 @@ Ext.define("Ext.ux.grid.Printer", {
' border-width: 1px;' +
' border-color: #ededed;' +
'}' +
'@media print{#noprint{display:none;}body{background:#fff;}}';
'@media print{@page {size: landscape};#noprint{display:none;}body{background:#fff;}}';

var htmlMarkup = [
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
Expand Down