[英]How to call Javascript from inside a PLSQL code in dynamic action of oracle apex
[英]How To Print Specific Div Of PLSql Dynamic Content in Oracle APEX5?
我已嘗試通過以下代碼進行操作,但整個頁面顯示空白。
1)粘貼HTML正文屬性
<script language="JavaScript">
function printPage() {
if(document.all) {
document.all.divButtons.style.visibility = 'hidden';
window.print();
document.all.divButtons.style.visibility = 'visible';
} else {
document.getElementById('divButtons').style.visibility = 'hidden';
window.print();
document.getElementById('divButtons').style.visibility = 'visible';
}
}
</script>
2) htp.p('<div id="divButtons" name="divButtons">' ); htp.p('</div>' );
htp.p('<div id="divButtons" name="divButtons">' ); htp.p('</div>' );
3) htp.p('<input type="button" value = "Print" onclick="printPage()" style="font:bold 11px verdana;color:#FF0000;background-color:#FFFFFF;">' );
這是PLSQL動態內容代碼:::
DECLARE
CURSOR order_list IS
SELECT m.item_name, a.order_quantity,a.price
FROM add_payment a,menu_item m
where order_id=61
and
m.m_id=a.m_id;
begin
htp.p('<div class="row">' );
htp.p('<div class="col-md-12">' );
htp.p('<div class="panel panel-default">' );
htp.p('<div class="panel-heading">' );
htp.p('<h3 class="text-center">' );
htp.p('<strong>Order Summary');
htp.p('</strong>' );
htp.p('</h3>' );
htp.p('</div>' );
htp.p('<div class="panel-body">');
htp.p('<div class="table-responsive">');
htp.p('<div id="divButtons" name="divButtons">' );
htp.p('<table class="table table-condensed">' );
htp.p('<thead>' );
htp.p('<tr>' );
htp.p('<td>' );
htp.p('<strong>Item Name');
htp.p('</strong>');
htp.p('</td>');
htp.p('<td class="text-center">');
htp.p('<strong>Item Price');
htp.p('</strong>');
htp.p('</td>');
htp.p('<td class="text-center">');
htp.p('<strong>Item Quantity');
htp.p('</strong>');
htp.p('</td>');
htp.p('<td class="text-right">');
htp.p('<strong>Total');
htp.p('</strong>');
htp.p('</td>');
htp.p('</tr>' );
htp.p('</thead>' );
htp.p('<tbody>' );
FOR a IN order_list LOOP
htp.p('<tr>' );
htp.p('<td>'||a.item_name||'');
htp.p('</td>' );
htp.p('<td class="text-center">'||a.order_quantity||'');
htp.p('</td>' );
htp.p('<td class="text-center">'||a.price||'' );
htp.p('</td>' );
htp.p('<td class="text-right">'||a.order_quantity*a.price||' Tk' );
htp.p('</td>' );
htp.p('</tr>' );
END LOOP;
htp.p('<tr>' );
htp.p('<td class="highrow">' );
htp.p('</td>');
htp.p('<td class="highrow">');
htp.p('</td>');
htp.p('<td class="highrow text-center">');
htp.p('<strong>Subtotal');
htp.p('</strong>');
htp.p('</td>');
htp.p('<td class="highrow text-right">$958.00');
htp.p('</td>');
htp.p('</tr>');
htp.p('<tr>');
htp.p('<td class="emptyrow">');
htp.p('</td>');
htp.p('<td class="emptyrow">');
htp.p('</td>');
htp.p('<td class="emptyrow text-center">');
htp.p('<strong>Shipping');
htp.p('</strong>');
htp.p('</td>');
htp.p('<td class="emptyrow text-right">$20');
htp.p('</td>');
htp.p('</tr>');
htp.p('<tr>');
htp.p('<td class="emptyrow">');
htp.p('<i class="fa fa-barcode iconbig">');
htp.p('</i>');
htp.p('</td>');
htp.p('<td class="emptyrow">');
htp.p('</td>');
htp.p('<td class="emptyrow text-center">');
htp.p('<strong>Total');
htp.p('</strong>');
htp.p('</td>');
htp.p('<td class="emptyrow text-right">$978.00');
htp.p('</td>');
htp.p('</tr>');
htp.p('</tbody>');
htp.p('</table>' );
htp.p('</div>' );
htp.p('</div>' );
htp.p('</div>' );
htp.p('</div>' );
htp.p('</div>' );
htp.p('</div>' );
htp.p('<input type="button" value = "Print" onclick="printPage()" style="font:bold 11px verdana;color:#FF0000;background-color:#FFFFFF;">' );
end;
看來您確實違反常規並手動編碼了許多開箱即用的內容。
至於您的打印,您可能對此方法感興趣
http://www.grassroots-oracle.com/2014/07/apex-printer-friendly-pages-with-css-media-queries.html
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.