3 Replies Latest reply: May 26, 2012 8:19 PM by Karsten Wutzke RSS

rich:inplaceInput: how to call a DB update action on bean? (need suggestions)

Karsten Wutzke Expert

Hello all,

 

I have several places where I was planning to use an rich:inplaceInput to store an entity string field inside. These inputs are presented in two ways: either in a rich:dataTable or in a rich:tree:

<rich:treeNode type="doc" id="doc-node">
      ...
      <rich:inplaceInput value="#{treeNode.node.name}"
                         editEvent="dblclick"
                         showControls="true"
                         saveOnBlur="false"
                         id="doc-node-name-inplace">
        ...
      </rich:inplaceInput>

 

As for display, these are fine right now, but...

 

Q:

 

What is the code pattern to determine the entity that owns/references the field/property when the input is changed? (here the #{treeNode.node} entity)

 

It's supposed to call a method like: (or similar)

public void updateNode(Node nd)
{
    ...
}

 

I thought there would be an action="" attribute for inplaceInput much like on a commandButton, but that doesn't exist. All there is is a changeListener.

 

Are there any alternative ways to that, e.g. using the buttons that I use above to confirm the changes?

 

Can anybody make some recommendations? What would be the code pattern here? I'd like to have something that is as little "hacky" as possible.

 

Karsten