1
votes

I'm trying to implement editable rows using rich:inplaceInput within a rich:dataTable. The issue here is that the edited value is not reflected in the backing bean.

<rich:column width="200px">
    <f:facet name="header">
        <h:outputText value="Roles" />
    </f:facet>

    <rich:inplaceInput id="roleText" value="#{role}" inputWidth="60px" controlsHorizontalPosition="right" 
                        showControls="true" editEvent="none">
        <f:facet name="controls">
            <h:panelGroup>
                <h:commandButton id="saveEdit" value="Save"
                                    action="#{manageRolesBean.editRoleAction}"
                                    image="/images/indicator_accept.gif" alt="Save" />

                <h:commandButton id="cancelEdit" value="Cancel"
                                    onclick="#{rich:component('rolesForm:roleText')}.cancel(); return false;"
                                    image="/images/indicator_reject.gif" alt="Cancel" />
            </h:panelGroup>
        </f:facet>
    </rich:inplaceInput>
</rich:column>

Clicking the Save button, gives an empty string in the backing bean. I've tried using a4j:actionParam to read the value from client side, but that doesn't work either:

<a4j:actionparam name="editedValue" value="#{rich:findComponent('roleText').value}" assignTo="#{manageRolesBean.role.name}" />

I'm limited to JSF 1.2 and RichFaces 3.3.X. The solution described here references a newer version. How do I save the edited value in the backing bean?

1

1 Answers

0
votes

I used Seam component as backing bean and value change listener in code below. Hope this helps.

<h:form>   
...
    <rich:column ...>        
        <rich:inplaceInput id="someString" value="#{someSeamComponent.someString}"
                           valueChangeListener="#{someSeamComponent.process}">
            <a:support event="onviewactivated"/>
        </rich:inplaceInput>
    </rich:column>
...
</h:form>

import org.jboss.seam.annotations.Name;
import javax.faces.event.ValueChangeEvent;

@Name("someSeamComponent")
public class SomeSeamComponent {
    private String someString;

    // getters and setters

    public void process(ValueChangeEvent event) {
        // event.getSource().getId() -> to distinguish the source. you may construct id using rowKeyVar or smth
        Object newVal = event.getNewValue();
    }
}

Hint: setter with new value for someString triggers as well.