0

so I am using the printer from Primefaces, but it can not find the id of the datatable im trying to print. Anyone know why? I have removed some code for clarity. I also got the printer working on a different site but its not working here

            <p:outputPanel id="topPanel" style=" display:block; height: 24%; float: top">                
                <h:form>     
                    <p:growl id="messages" showDetail="true" />
                    <p:toolbar style="width: 100%">                        
                        <f:facet name="right">
                            <div style="float: right">
                                <p:commandButton actionListener="#{s.save}" value="Bearbeiten">
                                    <f:param name="Bearbeiten" value="10" /> 
                                </p:commandButton> 
                                <p:commandButton value="Drucken" type="button" icon="ui-icon-print">
                                    <p:printer target="datatable"/>
                                </p:commandButton>
                            </div>                                             
                        </f:facet>
                    </p:toolbar>
                </h:form>    
            </p:outputPanel>

            <p:outputPanel id="datatable" style="height: 50%">
                <ui:insert name="datatable" />
                <p:dataTable var="item" value="" paginator="true" rows="10" selection="" id="Datatable">
                    <p:column style="width:16px;text-align:center"/> 
                    <p:column headerText="ID">
                        <h:outputText value="" />
                    </p:column>

                    <p:column headerText="Nachname">
                        <h:outputText value="" />
                    </p:column>

                    <p:column headerText="Vorname">
                        <h:outputText value="" />
                    </p:column>
                </p:dataTable>
            </p:outputPanel>
  • Your are targeting on purpose your panel?? Cause the id of your datatable is with capital letter. 'Datatable'(Datatable id) - 'datatable'(Printer target) – Manu AG May 18 '16 at 13:26
  • @ManuAG yes i am, but it doesnt matter either way i believe – Christian Paul May 18 '16 at 13:33
  • What's the Error?`I tried your code, it worked for me. – Mihawk May 18 '16 at 14:41
  • You checked the js console? Anything there after clicking the print button? – ForguesR May 18 '16 at 14:43
  • The error is that it cant find the component ID im targetting @Ovoxo. – Christian Paul May 18 '16 at 15:13
  • @ForguesR, the button works and prints a blank if i leave "target" blank, the console doesnt tell me more than that it cant find the target ID – Christian Paul May 18 '16 at 15:13
  • Possible duplicate of [How to find out client ID of component for ajax update/render? Cannot find component with expression "foo" referenced from "bar"](http://stackoverflow.com/questions/8634156/how-to-find-out-client-id-of-component-for-ajax-update-render-cannot-find-compo) – Kukeltje May 18 '16 at 16:10

0 Answers0