Search code examples
jsfrichfacesjsf-1.2richfaces-modal

JSF 1.2 table value as id for a4j command button


I have

<h:column headerClass="details_header">
    <h:panelGroup rendered="#{foo.checkIffooIsAvailable(table.YooId)}">
        <h:form>
            <h:inputHidden id="hiddenYooboo" value="#{table.YooId}" 
                binding="#{foo.hiddenInputValue}"/>
            <a4j:commandButton styleClass="quickYooButton fooButton"
                value="#{textElement.getText('foo')}" reRender="fooPanel" 
                action="#{foo.getFullfooAmount()}">
                <rich:componentControl for="fooPanel" event="oncomplete" 
                    operation="show" />
            </a4j:commandButton>
        </h:form>
    </h:panelGroup>
</h:column>

And backend

private Integer boo;
private BigDecimal partialfoo;
public List<Integer> fooTableYoos = new ArrayList<Integer>();
public UIInput hiddenInputValue;    

public Boolean checkIffooIsAvailable(Integer tableboo) {
    Iterator<Integer> iter = fooTableYoos.iterator();
    while (iter.hasNext()) {
        if (iter.next().compareTo(tableboo) == 0) {
            return true;
        } else {
            return false;
        }
    }
    return false;
}

public BigDecimal getFullfooAmount() {
    BigDecimal fooAmount = null;
    try {
        fooAmount = new BigDecimal(100);
        setFullfoo(fooAmount);
    } catch (Exception e) {
        log.error("getFullfooAmount()", e);
    }
    return fooAmount;
}
    public UIInput getHiddenInputValue() {
    return hiddenInputValue;
}

public void setHiddenInputValue(UIInput hiddenInputValue) {
    this.hiddenInputValue = hiddenInputValue;
}

Problem is that when I click on commandButton I get an error:

Could not instantiate Seam component: table.

I need on render of table check if boo is on list and when true render button. Then, when I have button, I need to check what id I've clicked and open modal with reloaded data by this id. There is no component named table. Couse it's only dataTable stuff. h:CommandButton works, but the modal after second close and don't reload data of modal.


Solution

  • Solution was changing type of dataTable to rich:dataTable