Hello,

  Using MyFaces 1.1,

  I have a table with rows containing editable data.
  I want to be able to sort it, and this works, thanks to commandsortheader.
  Now I need to put a combo in the header so that when the user select a value 
in the combo, only the rows with this value are displayed (filtering that 
is).

 So I did a selectonemenu with immediate="true" and then an 
onchange="submit()". Here is a snippet of the code.

                    <h:column>
                        <f:facet name="header">
                                <h:panelGroup>
                            <x:commandSortHeader columnName="columnKind" 
arrow="true">
                                <h:outputText value="KIND" />
                            </x:commandSortHeader>
                            <f:verbatim><br/></f:verbatim>
                            <h:selectOneMenu onchange="submit()" 
id="selectKind" 
value="#{CatalogContextBean.relationshipDefinitionProductListContext.kindFilter}"
 
styleClass="data" immediate="true">
                                <f:selectItems 
value="#{CatalogContextBean.relationshipDefinitionProductListContext.allProductKinds}"
 />
                            </h:selectOneMenu>
                            </h:panelGroup>
                        </f:facet>
                        <h:outputText 
value="#{NewProductRelationshipPage.wrappedRuleProduct.product.productType.kind.name}"
 />
                    </h:column>


This works except the rows data are submitted to the model !! Which I don't 
want.

 So I tried something like this:

                    <h:column>
                        <f:facet name="header">
                                <h:panelGroup>
                            <x:commandSortHeader columnName="columnKind" 
arrow="true">
                                <h:outputText value="KIND" />
                            </x:commandSortHeader>
                            <f:verbatim><br/></f:verbatim>
                            <h:selectOneMenu id="selectKind" 
value="#{CatalogContextBean.relationshipDefinitionProductListContext.kindFilter}"
 
styleClass="data" immediate="true">
                                <f:selectItems 
value="#{CatalogContextBean.relationshipDefinitionProductListContext.allProductKinds}"
 />
                            </h:selectOneMenu>
                            <h:commandLink immediate="true" 
value="#{CatalogContextBean.relationshipDefinitionProductListContext.filterAction}"><h:outputText
 
value="Filter !"/></h:commandLink>
                            </h:panelGroup>
                        </f:facet>
                        <h:outputText 
value="#{NewProductRelationshipPage.wrappedRuleProduct.product.productType.kind.name}"
 />
                    </h:column>

And now the value of the combo box is not setted when I click on Filter !, so 
I can't do the filtering.

The most fascinating is that the Sort works fine. Whereas it only seemed to be 
a command link like mine....

 Can some MyFaces Guru help please ?

 Gérard COLLIN.

Reply via email to