Special handling when printing for splitter

This commit is contained in:
Hadi Nategh 2015-02-12 12:44:22 +00:00
parent 5a13ccbbfc
commit dbdc14e376
2 changed files with 37 additions and 2 deletions

View File

@ -28,7 +28,7 @@
* @see http://methvin.com/splitter/ Uses Splitter
* @augments et2_DOMWidget
*/
var et2_split = et2_DOMWidget.extend([et2_IResizeable],
var et2_split = et2_DOMWidget.extend([et2_IResizeable,et2_IPrint],
{
attributes: {
"orientation": {
@ -85,6 +85,9 @@ var et2_split = et2_DOMWidget.extend([et2_IResizeable],
// Deferred object so we can wait for children
this.loading = jQuery.Deferred();
// Flag to temporarily ignore resizing
this.stop_resize = false;
},
destroy: function() {
@ -274,7 +277,7 @@ var et2_split = et2_DOMWidget.extend([et2_IResizeable],
{
this._init_splitter();
}
if(this.dynheight)
if(this.dynheight && !this.stop_resize )
{
var old = {w: this.div.width(), h: this.div.height()};
this.dynheight.update(function(w,h) {
@ -376,6 +379,25 @@ var et2_split = et2_DOMWidget.extend([et2_IResizeable],
*/
toggleDock: function() {
this.div.trigger("toggleDock");
},
// Printing
/**
* Prepare for printing by stopping all the fuss
*
*/
beforePrint: function() {
// Resizing causes preference changes & relayouts. Don't do it.
this.stop_resize = true;
// Add the class, if needed
this.div.addClass('print');
// Don't return anything, just work normally
},
afterPrint: function() {
this.div.removeClass('print');
this.stop_resize = false;
}
});

View File

@ -131,6 +131,15 @@ div.et2_hbox > div {
* > .et2_split {
overflow: hidden;
}
/* These need to be applied to tame the sizing before printing */
.et2_split.print, .et2_split.print > .splitter-pane {
height: auto !important;
width: auto !important;
}
.et2_split.print > * {
position: relative !important;
}
/**
* Label widget, and labels for other widgets
*/
@ -1159,6 +1168,10 @@ div.message.floating {
display: none;
border:none;
}
.et2_split, .et2_split > .splitter-pane {
height: auto !important;
width: auto !important;
}
}
/**
* Grid / nextmatch Hierarchy