In der [[custom.js]] muss [[jquery]] eingebunden sein. Falls dies nicht der Fall ist beim Laden der Smartform
jq= (this.form.ownerDocument.defaultView!=null) ? this.form.ownerDocument.defaultView.jQuery : this.form.ownerDocument.parentWindow.jQuery;
ausführen. Dies geschieht am besten in der [[initmethod]] die fast bei jedem Prozess automatisch geladen wird.
>> Beim Drucken bitte den Druckertreiber auf "**auf Seite anpassen**" auswählen
{{:projekt:jsfundgrube:image001.png?direct&200|}}
\\
Es muss nur noch die preparePrint Funktion in die custom.js eingefügt werden.
gadget.functions.preparePrint = function () {
function adjustMaskSize() {
var fullSizeDiv = document.getElementById("printFullSize");
fullSizeDiv.style.width = '0';
fullSizeDiv.style.height = '0';
fullSizeDiv.style.height = document.body.scrollHeight + 'px';
fullSizeDiv.style.width = document.body.scrollWidth + 'px';
}
var getParentWindow = function (obj) {
var d = obj && obj.ownerDocument ? obj.ownerDocument : doc;
return d.parentWindow || d.defaultView;
};
this.innerHTML="";
this.style.cursor="pointer";
this.onclick=function()
{
this.style.display="none";
var html = 'Print view ';
jq=getParentWindow(this).jQuery;
// adding styles
jq('link[href$=".css"]').each(function (idx, el) {
// Util.log("found link: " + el.href);
html += jq(el).clone().wrap('').parent().html();
});
html += '' +
' ';
jq('form').each(function() {
html += jq(this).clone().wrap('').parent().html().replace('id="local_zone"', 'class="local_zone"');
});
html += '';
var popupWindow = window.open('', '_blank',
'menubar=no,addressbar=no,location=no,resizable=yes,scrollbars=yes,status=no');
popupWindow.document.open();
popupWindow.document.write(html);
popupWindow.document.close();
popupWindow.print();
this.style.display="block";
}
};