onclick事件不适用于JSF

时间:2015-03-06 06:40:31

标签: jsf primefaces

我试图在Primefaces上进行onclick()工作。第一项"通配符"工作在页面上加载,但所有其他p:menuitem根本不起作用。

jQuery的:

function ShowLuceneInfo(part){

        jQuery('.luceneInfoMain > #fuzzySearches').addClass('displayNone');
        jQuery('.luceneInfoMain > #proximitySearches').addClass('displayNone');
        jQuery('.luceneInfoMain > #rangeSearches').addClass('displayNone');
        jQuery('.luceneInfoMain > #boostingATerm').addClass('displayNone');
        jQuery('.luceneInfoMain > #booleanOperators').addClass('displayNone');
        jQuery('.luceneInfoMain > #grouping').addClass('displayNone');
        jQuery('.luceneInfoMain > #escapingSpecialCharacters').addClass('displayNone');
        jQuery('.luceneInfoMain > #wildcardSearches').addClass('displayNone');

        jQuery('.ui-menu-item-label').removeClass('ui-state-selected');

        if(part == 'fuzzy'){
            jQuery('.luceneInfoMain div').removeClass('displayBlock');
            jQuery('.luceneInfoMain > #fuzzySearches').removeClass('displayNone');
            jQuery('.luceneInfoMain > #fuzzySearches').addClass('displayBlock');
            jQuery('#luceneID\\:luceneID\\:fuzzy').addClass('ui-state-selected');

        }
        else if(part == 'proximity'){
            jQuery('.luceneInfoMain div').removeClass('displayBlock');
            jQuery('.luceneInfoMain > #proximitySearches').removeClass('displayNone');
            jQuery('.luceneInfoMain > #proximitySearches').addClass('displayBlock');
            jQuery('#luceneID\\:luceneID\\:proximity').addClass('ui-state-selected');
        }
        else if(part == 'range'){
            jQuery('.luceneInfoMain div').removeClass('displayBlock');
            jQuery('.luceneInfoMain > #rangeSearches').removeClass('displayNone');
            jQuery('.luceneInfoMain > #rangeSearches').addClass('displayBlock');
            jQuery('#luceneID\\:luceneID\\:range').addClass('ui-state-selected');

p:menuitem上每个项目下方的Primefaces代码应显示右侧页面:

    <s:div styleClass="w30p floatL inlineBlock">
    <s:div styleClass="inlineBlock marB10 floatL w100p">
        <a4j:form id="luceneID">
            <p:menu id="luceneMenu" keepOpen="true">
                <p:submenu label="Supported" styleClass="fontBold">
                    <p:menuitem id="wildcard" styleClass="ui-state-selected"
                        value="Wildcard Searches" onclick="ShowLuceneInfo('wildcard')" />
                    <p:menuitem id="fuzzy" value="Fuzzy Searches" 
                        onclick="ShowLuceneInfo('fuzzy')" />
                    <p:menuitem id="proximity" value="Proximity Searches"
                        onclick="ShowLuceneInfo('proximity')." />
                    <ui:remove>
                    <p:menuitem id="range" value="Range Searches"
                        onclick="ShowLuceneInfo('range')" />
                    <p:menuitem id="boosting" value="Boosting a Term"
                        onclick="ShowLuceneInfo('boosting')" />
                    </ui:remove>
                    <p:menuitem id="boolean" value="Boolean Operators"
                        onclick="ShowLuceneInfo('boolean')" />
                    <p:menuitem id="grouping" value="Grouping"
                        onclick="ShowLuceneInfo('grouping')" />
                </p:submenu>
            </p:menu>
        </a4j:form>
    </s:div>

<s:div styleClass="inlineBlock floatL w100p">
        <a4j:form>
            <p:menu keepOpen="true">
                <p:submenu label="Not Supported" styleClass="fontBold">
                    <p:menuitem id="escape" value="Escaping Special Characters"
                        onclick="ShowLuceneInfo('escape')" />
                </p:submenu>
            </p:menu>
        </a4j:form>
    </s:div>
</s:div>

<s:div styleClass="floatL w69p marL1p luceneInfoMain">
    <rich:panel id="wildcardSearches" styleClass="marB10">
        <f:facet name="header">
            <s:div styleClass="panelHead inlineBlock">
                <s:span styleClass="breadCrumbText floatL marL5">
                    <h:outputText value="Wildcard Searches"></h:outputText>
                </s:span>
            </s:div>
        </f:facet>

        <s:div>
            <p class="marB10">Supported wildcards are *, which
            matches any character sequence and ?, which matches any single
            character. Note this query can be slow, as it needs to iterate over
            many terms.</p>
            <p class="marginBottomTen">In order to prevent extremely slow
            WildcardQueries, a Wildcard term should not start with one of the
            wildcards * or ?.</p>

            <rich:dataTable value="#{luceneSyntax.getWildcardSearches()}"
                var="_row" rowKeyVar="mainRowKey" rowClasses="odd-row, even-row"
                styleClass="marB10 w100p height100">

                <rich:column width="20%">
                    <f:facet name="header">
                        <h:outputText value="#{luceneSyntax.getColumnHeader1()}"
                            styleClass="fontBold"></h:outputText>
                    </f:facet>

                    <h:outputText value=" #{_row.get(0)}" escape="false" styleClass="txtAC fontBold" />
                </rich:column>

                <rich:column width="50%">
                    <f:facet name="header">
                        <h:outputText value="#{luceneSyntax.getColumnHeader2()}" styleClass="fontBold"></h:outputText>
                    </f:facet>

                    <h:outputText value=" #{_row.get(1)}" escape="false" styleClass="txtAL valignT" />
                </rich:column>

                <rich:column width="30%">
                    <f:facet name="header">
                        <h:outputText value="#{luceneSyntax.getColumnHeader3()}"
                            styleClass="fontBold"></h:outputText>
                    </f:facet>

                    <h:outputText value=" #{_row.get(2)}" escape="false" styleClass="txtAL valignT"/>
                </rich:column>

            </rich:dataTable>
        </s:div>
    </rich:panel>

    <rich:panel id="fuzzySearches"
        styleClass="marB10 displayNone">
        <f:facet name="header">
            <s:div styleClass="panelHead inlineBlock">
                <s:span styleClass="breadCrumbText floatL marL5">
                    <h:outputText value="Fuzzy Searches"></h:outputText>
                </s:span>
            </s:div>
        </f:facet>

        <s:div>
            <p class="marB10">Fuzzy searching will find a word even
            if it is misspelled. This can be useful when you are searching text
            that may contain typographical errors.</p>

            <rich:dataTable value="#{luceneSyntax.getFuzzySearches()}"
                var="_row" rowKeyVar="mainRowKey" rowClasses="odd-row, even-row"
                styleClass="marB10 w100p height100">

                <rich:column>
                    <f:facet name="header">
                        <h:outputText value="#{luceneSyntax.getColumnHeader1()}"
                            styleClass="fontBold"></h:outputText>
                    </f:facet>

                    <h:outputText value=" #{_row.get(0)}" escape="false" styleClass="txtAC fontBold"/>
                </rich:column>

                <rich:column>
                    <f:facet name="header">
                        <h:outputText value="#{luceneSyntax.getColumnHeader2()}"
                            styleClass="fontBold"></h:outputText>
                    </f:facet>

                    <h:outputText value=" #{_row.get(1)}" escape="false" styleClass="txtAL valignT"/>
                </rich:column>

                <rich:column>
                    <f:facet name="header">
                        <h:outputText value="#{luceneSyntax.getColumnHeader3()}"
                            styleClass="fontBold"></h:outputText>
                    </f:facet>

                    <h:outputText value=" #{_row.get(2)}" escape="false" styleClass="txtAL valignT"/>
                </rich:column>

            </rich:dataTable>
        </s:div>
    </rich:panel>

0 个答案:

没有答案