Search code examples
javajsffaceletsicefaces

How to prevent that rowSelector's clickAction method is fired when using any button on the page?


I have a ice:dataTable with a ice:rowSelector in one column, and a ice:selectBooleanCheckbox in another column. The ice:rowSelector has toggleOnInput set to false.
If I select a checkbox (with a click) in one row, the clickAction is not fired (because of toggleOnInput - so far, so good).
But If I click on a button on the same page after this, regardless of what action bindings they have, the rowSelector's clickAction is fired. Why?
Any ideas to prevent this?

Here is my page definition:

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:ice="http://www.icesoft.com/icefaces/component"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:h="http://java.sun.com/jsf/html">
    <f:view>
        <ice:form>
            <ice:commandButton value="Test" />

            <ice:dataTable id="dataTable"
                       value="#{PageBean.data}"
                       var="entity">
                <ice:column>
                    <ice:selectBooleanCheckbox />
                </ice:column>
                <ice:column>
                    <ice:outputText value="#{entity.name}" />
                    <ice:rowSelector clickAction="#{PageBean.clickAction}" toggleOnInput="false" />                 
                </ice:column>
            </ice:dataTable>
       </ice:form>
    </f:view>
</html>

Solution

  • You can try making different forms for other buttons in the page and the data table, we should not have nested forms but can have multiple forms

    Also I would suggest to use selectionAction attribute if you are performing an Action method to call when the respective row is clicked.

    Hope this could help you