dataTable incell editing (3.0M3)

UI Components for JSF
Post Reply
Organized
Posts: 7
Joined: 05 Aug 2011, 09:10

31 Aug 2011, 15:51

Hi

HOW does incell-editing in 3.0M3 work? I don't get it, the example in the showcase just sucks.

I load the data from a database and when I edited one row I want to update this to the database. In 2.2.1 it was possible to define a rowEditListener, but this attribute is not available in 3.0M3. How can I then call a method? This is crazy!

My dataTable:

Code: Select all

<p:dataTable var="n" value="#{manageNutzer.azubiList}" rowEditListener="#{manageNutzer.onEditRowAzubi}">
	<p:column headerText="#{lang.surnameLabel}">
		<p:cellEditor>
			<f:facet name="output">
				<h:outputText value="#{n.vname}" />
			</f:facet>
			<f:facet name="input">
				<p:inputText value="#{n.vname}" />
			</f:facet>
		</p:cellEditor>
	</p:column>
	<p:column headerText="#{lang.nameLabel}">
		<p:cellEditor>
			<f:facet name="output">
				<h:outputText value="#{n.name}" />
			</f:facet>
			<f:facet name="input">
				<p:inputText value="#{n.name}" />
			</f:facet>
		</p:cellEditor>
	</p:column>
	<p:column headerText="#{lang.emailLabel}">
		<p:cellEditor>
			<f:facet name="output">
				<h:outputText value="#{n.email}" />
			</f:facet>
			<f:facet name="input">
				<p:inputText value="#{n.email}" />
			</f:facet>
		</p:cellEditor>
	</p:column>
	<p:column headerText="#{lang.optionsLabel}">
		<p:rowEditor />
	</p:column>
</p:dataTable>
And my old method, working in 2.2.1:

Code: Select all

public void onEditRowAzubi(RowEditEvent event) {
	[...]
}
How to migrate to 3.0M3?

Greets,
Andy

cj91
Posts: 96
Joined: 04 Feb 2010, 00:07

31 Aug 2011, 16:48

This is a common question when migrating to 3.0. You need to add an ajax behavior to the table. Search for the forum for p:ajax

It'll end up being similar to the code example on the showcase. Here the "column resize" behavior is being used:

Code: Select all

 <p:ajax event="colResize" update=":form:growl" listener="#{tableBean.onResize}" />  

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

31 Aug 2011, 17:04

Wow... S*cks, crazy in one post... Realy motivating, thanks

Organized
Posts: 7
Joined: 05 Aug 2011, 09:10

01 Sep 2011, 09:22

Thanks, cj91 for your answer.

Where can I find a list of events? Due to the non-availibility of the documentation for 3.0M3 I suggest, that there is none yet.

This does not work:

Code: Select all

<p:dataTable var="n" value="#{manageNutzer.azubiList}">
	<p:ajax event="change" update="@this" listener="#{manageNutzer.onEditRowAzubi}" />
	[...]
</p:dataTable>

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 49 guests