Better handling of printing of various row quantities:

- print < loaded row count
- print > loaded row count
- print all rows
This commit is contained in:
Nathan Gray 2015-02-11 20:00:22 +00:00
parent 82f36e6de4
commit 92c26d156d
5 changed files with 30 additions and 7 deletions

View File

@ -1867,6 +1867,8 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput, et2_IPrin
// Trigger resize, so we can fit on a page // Trigger resize, so we can fit on a page
this.dynheight.outerNode.css('max-width',this.div.css('max-width')); this.dynheight.outerNode.css('max-width',this.div.css('max-width'));
this.resize(); this.resize();
// Reset height to auto (after width resize) so there's no restrictions
this.dynheight.innerNode.css('height', 'auto');
// Check for rows that aren't loaded yet, or lots of rows // Check for rows that aren't loaded yet, or lots of rows
var range = this.controller._grid.getIndexRange(); var range = this.controller._grid.getIndexRange();
@ -1898,6 +1900,8 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput, et2_IPrin
button = 'dialog[all]'; button = 'dialog[all]';
// Add the class, gives more reliable sizing // Add the class, gives more reliable sizing
this.div.addClass('print'); this.div.addClass('print');
// Show it all
$j('.egwGridView_scrollarea',this.div).css('height','auto');
} }
// We need more rows // We need more rows
if(button == 'dialog[all]' || value > loaded_count) if(button == 'dialog[all]' || value > loaded_count)
@ -1943,10 +1947,30 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput, et2_IPrin
defer.reject(); defer.reject();
return; return;
} }
nm.controller._grid.setScrollHeight(nm.controller._grid.getAverageHeight() * (value+1)); if(value < total)
{
// Set height to the requested number of rows, using the average height.
// We add one, in case there's some larger rows we
// try to get most of it but that's pretty hacky
nm.controller._grid.setScrollHeight(nm.controller._grid.getAverageHeight() * (value+1));
}
// Grid needs to redraw before it can be printed, so wait // Grid needs to redraw before it can be printed, so wait
window.setTimeout(jQuery.proxy(function() { window.setTimeout(jQuery.proxy(function() {
dialog.destroy(); dialog.destroy();
if(value < total)
{
// Show requested number, based on average height
nm.controller._grid.setScrollHeight(nm.controller._grid.getAverageHeight() * (value));
// No scrollbar in print view
$j('.egwGridView_scrollarea',this.div).css('overflow-y','hidden');
}
else
{
// Show it all
$j('.egwGridView_scrollarea',this.div).css('height','auto');
}
// Should be OK to print now // Should be OK to print now
defer.resolve(); defer.resolve();
},nm),ET2_GRID_INVALIDATE_TIMEOUT); },nm),ET2_GRID_INVALIDATE_TIMEOUT);
@ -1961,11 +1985,12 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput, et2_IPrin
else else
{ {
// Don't need more rows, limit to requested and finish // Don't need more rows, limit to requested and finish
this.controller._grid.setScrollHeight(this.controller._grid.getAverageHeight() * (value+1)); this.controller._grid.setScrollHeight(this.controller._grid.getAverageHeight() * (value));
// No scrollbar in print view
$j('.egwGridView_scrollarea',this.div).css('overflow-y','hidden');
// Give dialog a chance to close, or it will be in the print // Give dialog a chance to close, or it will be in the print
window.setTimeout(function() {defer.resolve();}, 0); window.setTimeout(function() {defer.resolve();}, 0);
} }
//this.controller._gridCallback(0, button == et2_dialog.OK_BUTTON ? value : this.controller._grid.getTotalCount());
},this), },this),
egw.lang('How many rows to print'), egw.lang('Print'), egw.lang('How many rows to print'), egw.lang('Print'),
Math.min(100, total), Math.min(100, total),
@ -1980,7 +2005,9 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput, et2_IPrin
} }
else else
{ {
// Show all rows
this.dynheight.innerNode.css('height', 'auto'); this.dynheight.innerNode.css('height', 'auto');
$j('.egwGridView_scrollarea',this.div).css('height','auto');
} }
// Don't return anything, just work normally // Don't return anything, just work normally
}, },

View File

@ -477,7 +477,6 @@ These are set via javascript before printing to help tame nextmatch's layout
for printing for printing
*/ */
.et2_nextmatch.print .egwGridView_scrollarea { .et2_nextmatch.print .egwGridView_scrollarea {
height: auto !important;
width: auto !important; width: auto !important;
} }
.et2_nextmatch.print > div { .et2_nextmatch.print > div {

View File

@ -752,7 +752,6 @@ blockquote blockquote blockquote blockquote blockquote blockquote{
height: auto !important; height: auto !important;
} }
html *, .td_display { html *, .td_display {
font-size: 12pt !important;
border-right: none !important; border-right: none !important;
border-left: none !important; border-left: none !important;
} }

View File

@ -748,7 +748,6 @@ blockquote blockquote blockquote blockquote blockquote blockquote {
} }
html *, html *,
.td_display { .td_display {
font-size: 12pt !important;
border-right: none !important; border-right: none !important;
border-left: none !important; border-left: none !important;
} }

View File

@ -12,7 +12,6 @@
* @version $Id$ * @version $Id$
*/ */
@import (reference) "../../../pixelegg/less/layout_definitions.less"; @import (reference) "../../../pixelegg/less/layout_definitions.less";
@import (reference) "../../../pixelegg/less/definitions.less"; @import (reference) "../../../pixelegg/less/definitions.less";
@import (less) "../default/app.css"; @import (less) "../default/app.css";