Ajax

Splash Forums Rewrite Users Ajax

Tagged: 

This topic contains 4 replies, has 2 voices, and was last updated by  Christian Kaltepoth 1 year, 4 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #27038

    Andreu
    Participant

    Have 1st page

            <h:form id="categories">
                <p:dataGrid var="category" 
                            value="#{categoryController.categories}" 
                            columns="4" layout="grid"
                            rows="16" id="cars" lazy="true">
                    <f:facet name="header">
                        CATEGORIES
                    </f:facet>
                    <h:link outcome="somethingList">
                        <p:panel header="#{category.id}" style="text-align:center">
                            <h:panelGrid columns="1" style="width:100%">
                                <p:graphicImage library="indexImages" 
                                                name="#{category.imageName}"/> 
                                <h:outputText value="#{category.categoryName}" />
                            </h:panelGrid>
                        </p:panel>
                        <f:param name="category" value="#{category.categoryName}" />
                    </h:link>
                </p:dataGrid>
            </h:form>
    • This topic was modified 1 year, 4 months ago by  Andreu.
    • This topic was modified 1 year, 4 months ago by  Andreu.
    #27039

    Andreu
    Participant

    on 2nd page have filter

            <!--FILTER-->
            <h:form id="detailedFilter">
                <p:growl id="filter" showDetail="true" />
                <p:panel header="-= FILTER =-" style="margin-bottom:10px;">
                    <p:panelGrid id="default" 
                                 columns="2" >
                        <p:outputLabel for="category" 
                                       value="Category: " />
                        <p:selectOneMenu id="category" 
                                         value="#{searchFilterController.CATEGORY}" 
                                         style="width:300px">
                            <p:ajax listener="#{searchFilterController.onCategoryChange()}"
                                    update="@form" />
                            <f:selectItem itemLabel="" 
                                          itemValue="" 
                                          noSelectionOption="true" />
                            <f:selectItems value="#{searchFilterController.CATEGORIES}" />
                        </p:selectOneMenu>
    
                        <p:outputLabel for="autoMark" 
                                       value="Mark: " />
                        <p:selectOneMenu id="autoMark" 
                                         value="#{searchFilterController.AUTO_MARK}" 
                                         style="width:300px">
                            <p:ajax listener="#{searchFilterController.onAutoMarkChange()}"
                                    update="autoModel" />
                            <f:selectItem itemLabel="" 
                                          itemValue="" 
                                          noSelectionOption="true" />
                            <f:selectItems value="#{searchFilterController.AUTO_MARKS}" />
                        </p:selectOneMenu>
                    </p:panelGrid>
    
                    <p:commandButton value="Submit" 
                                     update="filter" 
                                     actionListener="#{searchFilterController.displayLocation}" 
                                     icon="ui-icon-check" 
                    />
                </p:panel>
            </h:form>
    • This reply was modified 1 year, 4 months ago by  Andreu.
    • This reply was modified 1 year, 4 months ago by  Andreu.
    #27040

    Andreu
    Participant

    SearchFilterController

        public void onCategoryChange() {
            if (CATEGORY != null && !CATEGORY.equals("")) {
                //CategoryBean categoryBean = new CategoryBean(); // this don't work
                //categoryBean.setCategoryName(CATEGORY);         // this don't work
                AUTO_MARK = null;
                AUTO_MARKS = SEARCH_FILTER_DAO.getAutoMarksByCategory(CATEGORY);
            } else {
                AUTO_MARKS = new TreeMap<>();
            }
        }

    want update URL by change category in p:selectOneMenu this is possible?

    #27041

    Andreu
    Participant
         
        <url-mapping id="home">
            <pattern value="/" />
            <view-id value="/faces/index.xhtml" />
        </url-mapping>
        
        <url-mapping id="viewCategory">
            <pattern value="/category_#{ category : categoryBean.categoryName}"/>
            <view-id value="/faces/somethingList.xhtml"/>
        </url-mapping>
    #27047

    You have to redirect the user in this case. Not sure if this works from the PrimeFaces listener stuff.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

Comments are closed.