1 2 Previous Next 27 Replies Latest reply: Jan 21, 2013 12:01 PM by Roberto Cordoba RSS

Richfaces 4 datatable rowclick is not hitting the listener method

Shameer Kunjumohamed Newbie

I am migrating an application from richfaces 3 to 4. And I am stuck at the datatable.

 

The rowclick sends request to server and renders response, but not invoking the listener method. It is not even evaluating the method. I have tried giving a non-existing method name, it still doesn't complain at run time either. I am using the Richfaces 4.0.0 CR1 library.

 

Anyone has a clue, please help me.

 

Here is my datatable code.

Datatable

    <rich:dataTable id="customersTable"

            value="#{customerBean.customerList}"

            var="customer"

            rowKeyVar="rowKey">

                <a4j:ajax event="rowclick"

                        listener="#{customerBean.makeRowEditable}">

                 </a4j:ajax>

            <rich:column>

                <f:facet name="header">

                    Id

                </f:facet>

                #{customer.id}

            </rich:column>

            <rich:column>

                <f:facet name="header">

                    Name

                </f:facet>

                #{customer.name}

            </rich:column>

     </rich:dataTable>

 

The backing bean

CustomerBean.java

 

package myapp;

 

import java.util.ArrayList;

import java.util.List;

 

import javax.faces.event.AjaxBehaviorEvent;

 

import org.apache.commons.logging.Log;

import org.apache.commons.logging.LogFactory;

 

public class CustomerBean {

 

    protected Log log = LogFactory.getLog(this.getClass());

 

    private List<Customer> customerList;

    private Customer selectedCustomer;

 

    public CustomerBean() {

        log.warn("CustomeBean is instantiated." + this);

        this.customerList = new ArrayList<CustomerBean.Customer>();

        customerList.add(new Customer(1, "One"));

        customerList.add(new Customer(2, "Two"));

        customerList.add(new Customer(3, "Three"));

        customerList.add(new Customer(1, "Four"));

    }

 

    public List<Customer> getCustomerList() {

        return customerList;

    }

 

    public void setCustomerList(List<Customer> customerList) {

        this.customerList = customerList;

    }

 

    public Customer getSelectedCustomer() {

        return selectedCustomer;

    }

 

    public void setSelectedCustomer(Customer selectedCustomer) {

        this.selectedCustomer = selectedCustomer;

    }

 

    public void makeRowEditable(AjaxBehaviorEvent event) {

        log.warn("CustomerBean. makeRowEditable: ");

    }

 

    public void selectCustomer(Customer customer) {

        this.selectedCustomer = customer;

        log.warn("CustomerBean. selectCustomer: customer = " + customer);

    }

 

    public void unselectCustomer() {

        log.warn("CustomerBean. unselectCustomer: ");

        this.selectedCustomer = null;

    }

 

    public class Customer {

        private int id;

        private String name;

 

        public Customer() {

            // TODO Auto-generated constructor stub

        }

 

        public Customer(int id, String name) {

            super();

            this.id = id;

            this.name = name;

        }

 

        public int getId() {

            return id;

        }

 

        public void setId(int id) {

            this.id = id;

        }

 

        public String getName() {

            return name;

        }

 

        public void setName(String name) {

            this.name = name;

        }

 

 

    }

 

}

 

Thanks in advance for any help.

  • 2. Richfaces 4 datatable rowclick is not hitting the listener method
    Shameer Kunjumohamed Newbie

    Thanks Nick.

     

    This is actually blocking our migration.

     

    Awaiting to see this is fixed.

  • 3. Richfaces 4 datatable rowclick is not hitting the listener method
    paulkrautz Newbie

    Hi all,

     

    We are having similar issues. We thought Richfaces 4 migration is a good idea but it proved otherwise. Dont get me wrong, RF team always talk about how stable and well tested your product is but my experience with this release says the opposite.

     

    The above issue is such a basic feature. come on guys you can do better.

     

    Can you provide an urgent workaround for this issue? We need to release in about two weeks and such problems  are really rising questions in the team whether Richfaces is still the best option out there or whether we need look at alternative libraries.

     

    Regards

    -P

  • 4. Richfaces 4 datatable rowclick is not hitting the listener method
    Ilya Shaikovsky Master

    Guys as a workaround try to use jsFunction instead. define action instead of listener and pass rowKey as a parameter to identify clicked row at that action.

  • 5. Richfaces 4 datatable rowclick is not hitting the listener method
    paulkrautz Newbie

    I thought we use JSF to stay away from Javascript.

     

    I can't understand if Richfaces 4 is really tested that well, how can we have such fundamental issues?

  • 6. Richfaces 4 datatable rowclick is not hitting the listener method
    Ilya Shaikovsky Master
    I thought we use JSF to stay away from Javascript.

    so read about JSFunction it's main goal to free you from writing js just call it by name and it will generate proper ajax call.

    I can't understand if Richfaces 4 is really tested that well, how can we have such fundamental issues?

    issue which has workaround not looks so fundamental Besides I believe more important to fix the issues came from the community fast and not to test every release for more than a month to polish single milestone release There are no projects without issues I believe there are chanses to have no releases at all if try to test all possible usecases combinations for about 100 components

     

    So thanks to you guys! You keep us better and we doing our best to provide solutions as fast  as possible.

  • 7. Richfaces 4 datatable rowclick is not hitting the listener method
    paulkrautz Newbie

    Considering how long it took you to release RF4, I would expect a less buggy release.

     

    My projects release is coming up in two weeks and choosing Richfaces has put me in such a bad position as I was the guy responsible from choosing it in the first place. I am beginning to think that was a mistake these days.

     

    I know you guys work hard and certainly appreciate the effort but please please please don't release before there are any major bugs in the codebase. That puts the community members who are just devs like you , in a very difficult situation.

     

    If I get fired because of RF , can I come and join JBOSS

     

    Cheers

  • 8. Richfaces 4 datatable rowclick is not hitting the listener method
    Ilya Shaikovsky Master

    Just want to repeat one point again - if the issue has easy to use workaround - its priority getting lower in jira. We just have to concentrate on issues which has no solution without our fix. In other case simple develoeprs (guys just like us) will be in blocker situation

     

    If I get fired because of RF , can I come and join JBOSS

     

    http://community.jboss.org/message/590858#590858 - really no need to wait to try

  • 9. Richfaces 4 datatable rowclick is not hitting the listener method
    Shameer Kunjumohamed Newbie

    Hi Ilya,

     

    I have actually seen few other issues, such as - I am not able to pass parameters/attributes to an a4j:ajax event that calls a listener method, it behaves strange. That bug is actually outside the datatable, I tried it both inside and outside datatable, both cases it fails. I am not sure if I need to post it as separate thread.

     

    Let me make the problem clear.

     

    With RF 3.3.3, we we using a4j:support for firing server events from a rich/jsf component, now it is (I believe) replaced by a4j:ajax (or f:ajax). It works fine, except now it has some rules changed like now you cannot call it from some containers like rich:column or h:column. And, previously we used to send attributes from client to server using f:attribute.

     

    <a4j:support event="onclick"

       actionListener="#{my.listenerMethod}"

      reRender="comp1, comp2..">

        <f:attribute name="att1" value="#{obj1}"/>

        <f:attribute name="selectedKey" value="#{rowKey}"/>

    </a4j:support>

     

    Now with RF 4, if I add a similar f:attribute or f:param for that matter(within an a4j:ajax or even f:ajax), the event is not all getting fired. if you check the generated HTML code, you cannot see any click event to the component that invokes the event. If you add a f:param also, the event stops working.

     

    I noticed few other bugs as well, related to the ajax calls, which are crucial for any ajax based apps and framworks. I need to verify and record on what scenarios these bugs happen, and report, as I get time. Now actually we post poned the migration to RF 4 for another two weeks time, as i expect these issues will be fixed and you will release a patch soon, as this are really genuine and major problems.

     

    Ilya, even I feel the release is bit buggy and not well tested for some fundamental features, but I am much confident about RF than any other alternatives available, and have the trust on the community and team. Let us all help this greate framework to improve.

  • 10. Richfaces 4 datatable rowclick is not hitting the listener method
    Ilya Shaikovsky Master

    That problem is not really related to RichFaces :/

     

    That's sad and really not looks convininent but JSF 2 behavior can't works with children components. Just check the specification or just looks to ClientBehavior interface. It's not provides any getChildren as UIComponent does. So it will not works neither for a4j:ajax nor for f:ajax with current JSF 2 architecture.

     

    So try:

    <h:inputText value="#{userBean.name}">

       <a4j:param value="test" name="testparam"/>

       <a4j:ajax render="out, out2"/>

    </h:inputText>

    And get it from request map in listener (seeing param actually submitted in post parameters).

  • 11. Richfaces 4 datatable rowclick is not hitting the listener method
    Ilya Shaikovsky Master

    that's why our a4j:attachQueue implemented as just tag and not a component so could be nested to a4j:ajax but actually will just apply it's parameters to parent component.

  • 12. Richfaces 4 datatable rowclick is not hitting the listener method
    Nick Belaevski Master

    One small correction - it will work with action components - i.e. the ones that submit f:param values as part of request, but won't work for the rest of components.

  • 13. Richfaces 4 datatable rowclick is not hitting the listener method
    paulkrautz Newbie

    Just wanted to let you know that I am rolling back my RF4 migration efforts and probably will switch to another JSF implementation in the first chance to keep my insanity. Thank you Richfaces! thank you Jboss

  • 14. Richfaces 4 datatable rowclick is not hitting the listener method
    Jay Balunas Master

    Hi Paul & Shameer,

     

    We certainly appreciate you guys posting and letting us know some of the issue you have run into.

     

    Paul - before you finalize your plans please consider:

    • The listener issue is a bug, we should have caught it, but bugs happen
      • The workaround does not require JavaScript, and should solve the problem
        • Ilya just updated the jira with a code sample- RF-10824
      • We'll get this fix into SNAPSHOT, and our next release
    • The other issue with f:ajax/a4j:ajax is a JSF 2 specification restriction
      • Switching to another component library is not going to solve that
      • Please be sure to test that prior to a full migration
    • As a project - I think our components, framework, and community ( users & developers ) are top notch
      • Sure we have bugs, all projects do, but we address, reply, and work hard to get things fixed

     

    Paul/Shameer - you seem to reference other issues as well - can you let us know what those are?  Either as forum topics, or create jiras so we can review get some fixes and/or workarounds in?

     

    Thanks Guys,

    Jay

1 2 Previous Next