Differentiate in events

UI Components for JSF
Post Reply
giberius
Posts: 42
Joined: 08 Jan 2011, 14:20

23 Apr 2011, 22:28

I try to differeniate in events in an ajax call. I have set up:

Code: Select all

  <h:inputText value="#{test.naam}" valueChangeListener="#{test.change}"  >
                       <f:ajax event="[b]focus[/b]" listener="#{test.ajax1}" />
                       <f:ajax event="[b]change[/b]" listener="#{test.ajax2}" />
                   </h:inputText>
                   <br/><br/>
                   <h:inputText value="#{test.naam}" valueChangeListener="#{test.change}"  >
                       <p:ajax event="[b]focus[/b]" listener="#{test.ajax1}" />
                       <p:ajax event="[b]change[/b]" listener="#{test.ajax2}" />
                   </h:inputText>
                   <br/><br/>
                   <p:inputText value="#{test.naam}" valueChangeListener="#{test.change}"  >
                       <f:ajax event="[b]focus[/b]" listener="#{test.ajax1}" />
                       <f:ajax event="[b]change[/b]" listener="#{test.ajax2}" />
                   </p:inputText>
                   <br/><br/>
                   <p:inputText value="#{test.naam}" valueChangeListener="#{test.change}"  >
                       <p:ajax event="[b]focus[/b]" listener="#{test.ajax1}" />
                       <p:ajax event="[b]chang[/b]e" listener="#{test.ajax2}" />
                   </p:inputText>
In the situations where I use a <h:inputText> is seems to work. That means:
1) If I enter the field the onfocus listener fires only.
2) If I change the field the and then leave it, the onchange triggers fires only.

In the situations where I use a <p:inputText> only the onchange trigger fires.

I have got two questions:
1) Is JSF ment to differentiatie to different listeners on different events or is it sheer luck that it is working?
2) Why does is not work with <p:inutText>?

I try to make a master-detail screen with a multi-record master and a multierecord detail. Once the the record in the master get the focus I want to show the detail records belonging to that master record. I also need the respond on changes. So that's why I want to responds differentely to different events. I am using textInput fields and that does not work together with the rowSelectListener. I use textInput fields while I think that incell editing with the toggling of the rowEditor is clumsy and not a real good solution for a data entry screen. With the above "trick" to diffentiate between events I was able to build some kind of master-detail screen, but still I feell that I need a lot of tricks to get the Primefaces dataTable to do what I want.

Has somebody experience with mast-detail screens with textInputFields?

Could the dataTable be enhanced so that if you have textInputFields, the event like the rowSelectListener and so are working?

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 20 guests