java - Update primefaces growl from inside ui:component -
i have page form contains primefaces growl, , when adding message, , updating works well, shows , dissappears wanted.
i added templating of pages , have placed growl in seperate form inside main layout file, can used , updated every page using template. however, though try add message , update growl never shows up. though in response see update recivied server following:
<partial-response><changes><update id="growlform:growl"> <![cdata[<span id="growlform:growl"></span> <script id="growlform:growl_s" type="text/javascript"> $(function(){primefaces.cw('growl','widget_growlform_growl', {id:'growlform:growl',sticky:true,life:6000,escape:true,msgs: [{summary:"validation error!",detail:"please check input values.",severity:'error'}]});}); </script>]]> </update>..... more changes
pretty issue growl not show up. might not jsf templating, figured since worked on other page must because use same methods , everything.
the template system use:
common layout:
<h:head> <h:outputstylesheet name="style.css" library="css" /> <script type="text/javascript" src="../resources/js/common.js"></script> <title><ui:insert name="title"></ui:insert></title> </h:head> <h:body> <h:form id="growlform"> <p:growl id="growl" showdetail="true" sticky="true" /> </h:form> <div id="page"> <div id="header"> <ui:insert name="header"> <ui:include src="/restricted/templates/commonheader.xhtml" /> </ui:insert> </div> <div id="content"> <ui:insert name="content"> </ui:insert> </div> <div id="footer"> <ui:insert name="footer"> <ui:include src="/restricted/templates/commonfooter.xhtml" /> </ui:insert> </div> </div> </h:body>
actual form ui part:
<ui:define name="content"> <script> jquery(document).ready(function() { update(); }); </script> <h:form id="invoiceform" styleclass="defaultform"> <div class="defaultpanel"> //.. irrelevant content <span class="block"> <p:commandbutton id="submitbutton" actionlistener="#{invoicebean.submit}" value="#{msg.button_label_submit}" update=":invoiceform :growlform:growl" oncomplete="update()" /> </span> </div> </h:form> </ui:define>
can please me how can growl show up?
edit
someone asked post code of "update()" function nothing ust updates input values based on other , in test phase tried rename , still growl not show.
function update() { // document.getelementbyid("total_price_amount").value = tofixed(ish * // 1.2,2); var sumnet = 0; var sumtax = 0; var sumtotal = 0; var selectvat = document.getelementbyid("invoiceform:vat"); var label = selectvat.options[selectvat.selectedindex].text; var valueastext = label.substring(0, label.length - 1); var valueasint = parseint(valueastext); var defaulttax = valueasint / 100; $("[id$='articleitemreference']") .each( function() { var currentid = $(this).attr('id'); var prefix = currentid.replace('articleitemreference', ''); var quantity = document.getelementbyid(prefix + 'quantity').value; var price = document.getelementbyid(prefix + 'price').value; // set price incl vat var priceincl = tofixed((1 + defaulttax) * price); document.getelementbyid(prefix + 'priceinclvat').value = priceincl; var discountamount = document.getelementbyid(prefix + 'discount').value; var discounttype = document.getelementbyid(prefix + 'discounttype').value; var totalprice = price * quantity; var totalpricewithdiscount; if (discounttype == 'percent') { totalpricewithdiscount = totalprice * ((100 - discountamount) / 100); } else { totalpricewithdiscount = totalprice - discountamount; } document.getelementbyid(prefix + 'sum').value = tofixed( totalpricewithdiscount, 2); var tax = totalpricewithdiscount * defaulttax; sumnet = sumnet + totalpricewithdiscount; sumtax = sumtax + tax; sumtotal = sumtotal + (totalpricewithdiscount + tax); }); document.getelementbyid("invoiceform:sumofall").innerhtml = tofixed( sumtotal, 2); document.getelementbyid("invoiceform:sumoftax").innerhtml = tofixed(sumtax, 2); document.getelementbyid("invoiceform:sumofnet").innerhtml = tofixed(sumnet, 2); }
Comments
Post a Comment