开发者

Primefaces inplace events not fired inside datatable

I'm using jsf 2.0, primefaces 3.0M3 and jboss 6.0.0 in a project. I'm trying to make a table cell editable as in primefaces showcase, but the events to save and cancel didn't get fired. So, I decided to try and make only one field editable inside the datable with an inplace element and use the save event. It didn't work also. The code is as follow:

<ui:define name="search_results">
        <h:form id="search_results">
        <p:dataTable id="tbl" var="amb" value="#{environment.searchResult}">
            <p:column id="firstcolumn">
                <f:facet id="nameFct" name="header">#{label['menu.admin.environment']}</f:facet>
                <p:inplace editor="true" effectSpeed="fast" event="dblclick">
                    <p:inputText value="#{amb.dsAmbiente}" />
                    <p:ajax event="save" listener="#{environment.update(amb)}" />
                </p:inplace>
            </p:column>
        </p:dataTabl开发者_JAVA技巧e>
        </h:form>
    </ui:define>

and the class that is called in the listener

@Named("environment")
@ViewScoped
public class Environment extends AbstractBean implements Serializable{
private static final long serialVersionUID = 1L;

private AmbienteRemote environmentRemote;
private List<Empresa> companies;
private Ambiente env;
@Inject
private transient FacesContext context;
@Inject
private transient Messages messages;
private String compSearch;
private String envSearch;
private EnumFlStatusAmbiente statusSearch;
private List<Ambiente> searchResult;

public Environment()
{

}
//....

public String update(final Ambiente amb)
{
    System.out.println("update");

    return null;
}

//....
}

Can anybody help?

Thanks

Kelly


CDI components (annotated with @Named) does not have @ViewScoped.
You can't mix JSF Managed Beans imports with CDI imports.

Try to use sessionScope (remember - class have to implements Serializable).

(ps: Probably you will use wrong import such as
import javax.faces.bean.SessionScoped;
instead
import javax.enterprise.context.SessionScoped;)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜