Primefaces inputText无法获得焦点

时间:2017-02-07 10:16:29

标签: jsf primefaces jsf-2 focus editor

这是一个非常复杂的情况。我正在使用primefaces。

我是一个p:tabview:

  • 在第一个标签中有一个p:inputText id =" giorniRisp"
  • 在第二个p:编辑器(有多个,都表现出相同的行为)

现在,如果我将注意力集中在编辑器上,然后更改选项卡没有删除焦点,我就无法在inputText中写入:它没有被禁用,只是它不打印我写的东西。使用'标签'要改变输入,它会重新开始工作。但是,如果在更改选项卡之前我通过从编辑器中单击来删除焦点,则输入文本可以正常工作。

有人可以帮助我吗?

编辑

<p:tabView id="tabView"
    widgetVar="tabView"
    onTabShow="salvaIdx()">

    <!-- Tab Exit Meeting -->
    <p:tab title="#{auditVerificheBundle.title_exit_meeting}">
        <ui:include src="/verifiche/tab_audit_exit_meeting.xhtml" />
    </p:tab>    

    <!-- Tab Scheda di Sintesi -->
    <p:tab title="#{auditVerificheBundle.title_scheda_sintesi}">
        <ui:include src="/verifiche/tab_audit_schede_sintesi.xhtml" />
    </p:tab> 

    <p:ajax event="tabChange" update="@form" listener="#{auditExitMeetingButtonBean.reloadForm()}"/>

</p:tabView>

tab_audit_exit_meeting.xhtml

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:p="http://primefaces.org/ui"
    xmlns:documentale="http://java.sun.com/jsf/composite/documentale"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:sm="http://www.gft.com/jsf/component">

    <div class="sintesiTableBorder">

        <!-- tabella documenti -->
        <div id="cruscottoDocumentale">
            <p:dataTable id="docExit" value="#{auditExitMeetingButtonBean.rows}"
                emptyMessage="#{documentaleBundle.rendicontazioneVuotaMessage}"
                var="row" styleClass="sintesiTable"
                style="margin-top : 10px;width: 100%;">

                <!-- NOME DOCUMENTI -->
                <p:column style="height : 20px;width: 30%;">
                    <f:facet styleClass="header" name="header">
                        <h:outputText
                            value="#{documentaleBundle.label_ssrs_grc_table_tipo_doc}" />
                    </f:facet>
                    <h:outputText value="#{row.reportLabel}" />
                </p:column>

                <!-- COLONNA DELLE AZIONI -->
                <p:column style="height : 20px;width: 20%;">
                    <f:facet name="header">
                        <h:outputText
                            value="#{anagraficheComuniReportsBundle.label_documento}" />
                    </f:facet>
                            <!-- Download dei documenti elaborati -->
                    <p:commandLink
                        oncomplete="javascript:PF('downloadDocumentDialog').show()"
                        actionListener="#{auditExitMeetingButtonBean.onDownloadDocument(row)}"
                        title="#{auditExitMeetingButtonBean.completeMessageBundle('tooltip_download',row)}"
                        update=":errorMeeting :exitDocDialog"
                        style="float: right;margin-right:100px;">
                        <h:graphicImage
                            value="#{resource['images/document_download.png']}"
                            title="#{auditExitMeetingButtonBean.completeMessageBundle('tooltip_download',row)}" />
                    </p:commandLink>
                    <!-- Allega documenti -->
                    <p:commandLink
                        oncomplete="PF('#{dettaglioDocumento.getWidgetVarAttachDocumentDialog()}').show();"
                        actionListener="#{auditExitMeetingBean.onAttachDocument(row)}"
                        disabled="#{!auditExitMeetingButtonBean.canAttachDocument(row)}"
                        update=":exitMeetingForm :exitDocDialog"
                        style="float: right;margin-right:20px;">
                        <h:graphicImage
                            value="#{resource['images/attachDocument.png']}"
                            title="#{documentaleBundle.tooltipAllegaDocumento}" />
                    </p:commandLink>


                </p:column>
            </p:dataTable>

        </div>


        <div class="ui-grid ui-grid-responsive" style="border-bottom: none">
            <div class="ui-grid-row" style="margin-top: 15px;">
                <!-- DATA FINE VERIFICA -->
                <div class="ui-grid-col-2" style="margin-top: 5px; margin-left: 45px">
                    <h:outputText
                        value="#{auditVerificheBundle.label_data_fine_verifica_obbl}" />
                </div>
                <div class="ui-grid-col-4">
                    <p:calendar id="dataChiusutaAudit"
                        value="#{auditExitMeetingBean.dataChiusuraAudit}"
                        pattern="dd/MM/yyyy" navigator="true" readonlyInput="true"
                        mindate="#{auditExitMeetingBean.getMinDataFineVerifica()}"
                        maxdate="#{auditExitMeetingBean.getMaxDataFineVerifica()}"
                        style="padding: 0; float: left; width: 95%;"
                        disabled="#{auditExitMeetingBean.solaLettura || auditExitMeetingBean.disableComponents()}" />
                </div>
            </div>
            <div class="ui-grid-row" style="margin-top: 15px">
                <!-- NON SI ATTENDE RISPOSTA -->
                <div class="ui-grid-col-2" style="margin-top: 5px; margin-left: 45px">
                    <h:outputText value="#{auditVerificheBundle.label_non_si_attende_risposta}" />
                </div>
                <!-- FLAG: NON SI ATTENDE RISPOSTA -->
                <div class="ui-grid-col-2">
                    <p:selectBooleanCheckbox id="notGiorniRisposta"
                        value="#{auditExitMeetingBean.notGiorniRisposta}"
                        disabled="#{auditExitMeetingBean.disableComponents()}">
                        <p:ajax listener="#{auditExitMeetingBean.changeNotGiorni()}"
                            update=":exitMeetingForm:tabView:dataExitMeeting, 
                                    :exitMeetingForm:tabView:giorniRisp, 
                                    :exitMeetingForm:tabView:areaNota,
                                    :errorMeeting" />
                    </p:selectBooleanCheckbox>
                </div>
                <!-- GIORNI PER LA RISPOSTA -->
                <div class="ui-grid-col-3" style="margin-top: 5px; margin-left: 45px">
                    <h:outputText value="#{auditVerificheBundle.label_giorni_risposta}" />
                </div>
                <div class="ui-grid-col-3">

                    <p:inputText id="giorniRisp"
                        value="#{auditExitMeetingBean.giorniRispostaValue}"
                        style="width: 50px; margin-right: 10px"
                        disabled="#{auditExitMeetingBean.disableGiorniRisposta()}"
                        onkeydown="return onlyIntNumber(event)" widgetVar="giorniRisp">
                        <p:ajax event="blur"
                            listener="#{auditExitMeetingBean.updateResponseDayMethod}" />
                    </p:inputText>
                    <p:commandLink
                        actionListener="#{auditExitMeetingBean.svuotaGiorniRisposta()}"
                        disabled="#{auditExitMeetingBean.solaLettura || auditExitMeetingBean.disableComponents()}"
                        onclick="javascript:setEmptyField('giorniRisp')"
                        update="giorniRisp">
                        <h:graphicImage value="#{resource['images/x.png']}"
                            title="#{auditValutazioniBundle.label_svuota_override}"
                            style="margin-bottom:-4px; margin-left: 5px" />
                    </p:commandLink>
                </div>
            </div>
        </div>

        <div class="widget-header-rounded-grey_wrapper"
                    style="margin-top: 10px;">
            <div class="widget-header-rounded-grey " style="text-align: center">
                <sm:toggleButton cid="exitMeetingToggle" contentID="exitMeetingContent" 
                                 disabled="false" 
                                 hideIcoClass="ui-icon ui-icon-triangle-1-s"
                                 showIcoClass="ui-icon ui-icon-triangle-1-e" />
                    #{auditVerificheBundle.title_exit_meeting}
            </div>
        </div>
        <div id="exitMeetingContent" class="ui-grid ui-grid-responsive" 
             style="border-bottom: none">
            <!-- NOT EXIT MEETING -->
            <div class="ui-grid-row" style="margin-left: 100px; margin-top: 15px">
                <!-- NOT EXIT MEETING -->
                <div class="ui-grid-col-3" style="margin-top: 5px">
                    <h:outputText value="#{auditVerificheBundle.lable_not_exit_meeting}" />
                </div>
                <div class="ui-grid-col-2" style="margin-top: 5px">
                    <p:selectBooleanCheckbox id="notExitMeeting"
                        value="#{auditExitMeetingBean.notExitMeeting}"
                        disabled="#{auditExitMeetingBean.disableComponents()}">
                        <p:ajax listener="#{auditExitMeetingBean.changeNotMeeting()}"
                            update=":exitMeetingForm:tabView:dataExitMeeting, 
                                    :exitMeetingForm:tabView:giorniRisp, 
                                    :exitMeetingForm:tabView:areaNota,
                                    :errorMeeting" />
                    </p:selectBooleanCheckbox>
                </div>
            <!-- DATA EXIT MEETING -->
                <div class="ui-grid-col-2" style="margin-top: 5px">
                    <h:outputText
                        value="#{auditVerificheBundle.label_data_exit_meeting_obbl}" />
                </div>
                <div class="ui-grid-col-3">
                    <p:calendar id="dataExitMeeting"
                        value="#{auditExitMeetingBean.dataExitMeeting}"
                        pattern="dd/MM/yyyy" navigator="true" readonlyInput="true"
                        mindate="#{auditExitMeetingBean.getMinDataExitMeeting()}"
                        maxdate="#{auditExitMeetingBean.getMaxDataExitMeeting()}"
                        style="padding: 0; float: left;"
                        disabled="#{auditExitMeetingBean.solaLettura || auditExitMeetingBean.notExitMeeting || auditExitMeetingBean.disableComponents()}" />
                    <p:commandLink
                        actionListener="#{auditExitMeetingBean.svuotaDataMeeting()}"
                        disabled="#{auditExitMeetingBean.solaLettura || auditExitMeetingBean.disableComponents()}"
                        update="dataExitMeeting">
                        <h:graphicImage value="#{resource['images/x.png']}"
                            title="#{auditValutazioniBundle.label_svuota_override}"
                            style="margin-bottom:-4px; margin-left: 5px" />
                    </p:commandLink>
                </div>
            </div>

            <div  class="ui-grid-row" style="margin-top: 15px">
                <!-- NOTA EXIT MEETING -->
                <div class="ui-grid-col-12" style="margin-top: 5px">

                    <div id="notaExit" style="margin-top: 15px; width: 90%; float: right; margin-right: 35px;">
                        <div class="widget-header-rounded_wrapper">
                            <div class="widget-header-rounded2">
                                <h:outputText
                                    value="#{auditVerificheBundle.label_nota_exit_meeting}" />
                                <h:graphicImage value="#{resource['images/ico_salvataggio_w.png']}"
                                    title="#{documentaleBundle.salvaNota}" styleClass="cm-top3px"
                                    style="float: right">
                                    <p:ajax event="click"
                                        listener="#{auditExitMeetingBean.saveNotaMeeting}"
                                        process=":exitMeetingForm" update=":exitMeetingForm :errorMeeting" />
                                </h:graphicImage>
                            </div>
                        </div>
                        <div style="width: 100%; margin-right: 37px;" class="sintesiTableBorder_grey">
                            <p:editor id="areaNota" style="width:100%;"
                                value="#{auditExitMeetingBean.notaMeeting}"
                                controls="#{auditExitMeetingBean.getComponentsEditor()}"
                                disabled="#{auditExitMeetingBean.solaLettura || auditExitMeetingBean.notExitMeeting || auditExitMeetingBean.disableComponents()}" />
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- PULSANTI DI FINE PAGINA -->
        <div class="widget-footer cf"
            style="margin-top: 15px;">

            <!-- Salva -->
            <p:commandButton id="salva" widgetVar="salva"
                disabled="#{!auditExitMeetingButtonBean.enableSave()}"
                onclick="PrimeFaces.widgets['salva'].disable(), changeZIndexProperty('elementForDisable', 1000000);"
                actionListener="#{auditExitMeetingButtonBean.submitForm()}"
                process=":exitMeetingForm :exitMeetingDialog"
                value="#{auditVerificheBundle.button_salva}"
                update=":errorMeeting :exitMeetingForm :infoMeeting" 
                style="float:right" />
        </div>
    </div>


    <!-- ========================= -->
    <!-- ======== POP-UP ========= -->
    <!-- ========================= -->


    <!-- DIALOG PER ALLEGARE I DOCUMENTI -->
    <p:dialog id="attachDocumentDialog"
        .....
    </p:dialog>
</ui:composition>

tab_audit_schede_sintesi.xhtml

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:p="http://primefaces.org/ui"
    xmlns:documentale="http://java.sun.com/jsf/composite/documentale"
    xmlns:f="http://java.sun.com/jsf/core">

    <div class="sintesiTableBorder">

        <!-- tabella documenti -->
        <div id="cruscottoDocumentale">
            <p:dataTable id="docExitSintesi"
                value="#{auditExitMeetingButtonBean.rowsSchedaSintesi}"
                emptyMessage="#{documentaleBundle.rendicontazioneVuotaMessage}"
                var="row" styleClass="sintesiTable"
                style="margin-top : 10px;width: 100%;">

                <!-- NOME DOCUMENTI -->
                <p:column style="height : 20px;width: 30%;">
                    <f:facet styleClass="header" name="header">
                        <h:outputText
                            value="#{documentaleBundle.label_ssrs_grc_table_tipo_doc}" />
                    </f:facet>
                    <h:outputText value="#{row.reportLabel}" />
                </p:column>

                <!-- COLONNA DELLE AZIONI -->
                <p:column style="height : 20px;width: 20%;">
                    <f:facet name="header">
                        <h:outputText
                            value="#{anagraficheComuniReportsBundle.label_documento}" />
                    </f:facet>

                    <!-- Download dei documenti elaborati -->
                    <p:commandLink
                        oncomplete="javascript:PF('downloadDocumentDialog').show()"
                        actionListener="#{auditExitMeetingButtonBean.onDownloadDocument(row)}"
                        title="#{auditExitMeetingButtonBean.completeMessageBundle('tooltip_download',row)}"
                        update=":errorMeeting :exitDocDialog"
                        style="float: right;margin-right:70px;">
                        <h:graphicImage value="#{resource['images/document_download.png']}"
                            title="#{auditExitMeetingButtonBean.completeMessageBundle('tooltip_download',row)}" />
                    </p:commandLink>
                    <!-- Allega documenti -->
                    <p:commandLink
                        oncomplete="PF('#{dettaglioDocumento.getWidgetVarAttachDocumentDialog()}').show();"
                        actionListener="#{auditExitMeetingButtonBean.onAttachDocument(row)}"
                        disabled="#{!auditExitMeetingButtonBean.canAttachDocument(row)}"
                        update=":exitMeetingForm :exitDocDialog"
                        style="float: right;margin-right:15px;">
                        <h:graphicImage value="#{resource['images/attachDocument.png']}"
                            title="#{documentaleBundle.tooltipAllegaDocumento}" />
                    </p:commandLink>

                    <!-- elaborazione (generazione ed upload) report -->
                    <p:commandLink style="float: right; margin-right: 15px"
                        actionListener="#{auditExitMeetingButtonBean.onElaborazione(row)}"
                        disabled="#{!auditExitMeetingButtonBean.canAttachDocument(row)}"
                        update="@form, :exitDocDialog" ajax="true">
                        <h:graphicImage value="#{resource['images/play.png']}"
                            title="#{auditExitMeetingButtonBean.completeMessageBundle('tooltip_elaborazione',row)}"
                            alt="#{auditExitMeetingButtonBean.completeMessageBundle('tooltip_elaborazione',row)}" />
                    </p:commandLink>

                <!-- Preview -->
                <p:commandLink update=":exitMeetingForm"
                    onclick="javascript:window.open('#{auditSchedaSintesiBean.resolvePreviewURL(row)}'); return false;"
                    style="float: right;margin-right:15px;">
                    <h:graphicImage value="#{resource['images/lente.png']}"
                        title="#{auditExitMeetingButtonBean.completeMessageBundle('tooltip_previewDocumento',row)}"
                        alt="#{auditExitMeetingButtonBean.completeMessageBundle('tooltip_previewDocumento',row)}" />
                </p:commandLink>

                <ui:remove>
                    <!-- Export Pdf -->
                    <p:commandLink update=":exitMeetingForm"
                        onclick="javascript:window.open('#{auditSchedaSintesiBean.resolveExportPdfURL(row)}'); return false;"
                        style="float: right;margin-right:15px;">
                        <h:graphicImage value="#{resource['images/pdf.png']}"
                            title="#{auditExitMeetingButtonBean.completeMessageBundle('tooltip_exportPdf',row)}"
                            alt="#{auditExitMeetingButtonBean.completeMessageBundle('tooltip_exportPdf',row)}" />
                    </p:commandLink>
                </ui:remove>

                </p:column>
            </p:dataTable>

        </div>
        <!-- SINTESI VERIFICA -->
        <div class="ui-grid ui-grid-responsive" >
            <div class="ui-grid-row" style="margin-top: 15px; margin-bottom: 15px">
                <div class="ui-grid-col-2">
                    #{auditVerificheBundle.label_sintesi_verifica}</div>
                <div class="ui-grid-col-10">
                    <p:editor style="border-style: solid; border-width: 1px; width: 95%"
                        value="#{auditSchedaSintesiBean.sintesiVerifica}"
                        disabled="#{auditSchedaSintesiBean.solaLettura || auditSchedaSintesiBean.disableComponents()}"
                        process=":exitMeetingForm" update=":exitMeetingForm :errorMeeting"
                        controls="#{auditSchedaSintesiBean.getComponentsEditor()}" />
                </div>
            </div>
            <!-- SINTESI VALUTAZIONE -->
            <div class="ui-grid-row" style="margin-top: 15px; margin-bottom: 15px">
                <div class="ui-grid-col-2">
                    #{auditVerificheBundle.label_sintesi_valutazione}</div>
                <div class="ui-grid-col-10">
                    <p:editor style="border-style: solid; border-width: 1px; width: 95%"
                        value="#{auditSchedaSintesiBean.sintesiValutazione}"
                        disabled="#{auditSchedaSintesiBean.solaLettura || auditSchedaSintesiBean.disableComponents()}"
                        process=":exitMeetingForm" update=":exitMeetingForm :errorMeeting"
                        controls="#{auditSchedaSintesiBean.getComponentsEditor()}" />
                </div>
            </div>
            <!--  NOTE 231 -->
            <div class="ui-grid-row" style="margin-top: 15px; margin-bottom: 15px">
                <div class="ui-grid-col-2">
                    <h:outputText value="#{auditVerificheBundle.label_note231}"
                        rendered="#{auditSchedaSintesiBean.renderNote231()}" />
                </div>
                <div class="ui-grid-col-10">
                    <p:editor style="border-style: solid; border-width: 1px; width: 95%"
                        value="#{auditSchedaSintesiBean.note231}"
                        disabled="#{auditSchedaSintesiBean.solaLettura || auditSchedaSintesiBean.disableComponents()}"
                        process=":exitMeetingForm" update=":exitMeetingForm :errorMeeting"
                        rendered="#{auditSchedaSintesiBean.renderNote231()}"
                        controls="#{auditSchedaSintesiBean.getComponentsEditor()}" />
                </div>
            </div>
        </div>

        <!-- PULSANTI DI FINE PAGINA -->
        <div class="widget-footer cf">
            <p:commandButton id="dateVerificaButton"
                widgetVar="dateVerificaButton"
                actionListener="#{auditSchedaSintesiBean.openDialogDate()}"
                value="#{auditVerificheBundle.button_date_verifica}"
                title="#{auditVerificheBundle.button_date_verifica}"
                update=":errorMeeting :exitMeetingForm"
                style="float:right">
                <f:actionListener binding="#{audVisualizzaDateVerificaBean.init()}" />
            </p:commandButton>

            <!-- Salva -->
            <p:commandButton id="salvaSint" widgetVar="salvaSint"
                disabled="#{!auditExitMeetingButtonBean.enableSave()}"
                onclick="PrimeFaces.widgets['salvaSint'].disable(), changeZIndexProperty('elementForDisable', 1000000);"
                actionListener="#{auditExitMeetingButtonBean.submitForm()}"
                process=":exitMeetingForm :exitMeetingDialog"
                value="#{auditVerificheBundle.button_salva}"
                update=":errorMeeting :exitMeetingForm :infoMeeting" 
                style="float:right" />
        </div>
    </div>

    <!-- Dialog delle date -->  
    <ui:include src="/verifiche/audit_popup_date_sintesi.xhtml" />

</ui:composition>

0 个答案:

没有答案