3 Replies Latest reply on May 16, 2011 9:01 AM by Martin Dubuc

    Data table filtering issue in RichFaces 4

    Martin Dubuc Newbie

      I am having a bit of an issue with use of data table filtering. I would like to use a rich:dataTable to present some data and would like to perform filtering based on content of one of the columns. My understanding is that I must define the filterValue and filterExpression properties on the filtering column and an h:inputText in the header facet of the column to perform the filtering. I also need to attach a a4j:event to the h:inputText in order for the table to be re-rendered on a blur event. There is one column defined in my table that contains h:selectBooleanCheckbox (which purpose is to select a set of rows in the table). There is a rendering problem when the focus is in the filtering h:inputText and the user clicks on one of the h:selectBooleanCheckbox checkboxes in the table. What happens is that the checkbox gets checked on the mouse click, but the click creates a blur event, which eventually leads to the application re-rendering the table. When the application re-renders the table, the checkbox that was just checked will come back to its original value of being unchecked.

       

      I am not sure how to solve this issue. I thought that maybe I should use keyup event instead of blur, but I can't get the keyup event to work properly. When I use keyup, each character is initially displayed in the h:inputText, but the h:inputText is blanked out when the table is re-rendered and the focus does not stay in the h:inputText component.

       

      In 3.3.3, I would add the sortable, filterBy and filterEvent property to the column and an inputText field would appear at top of column. The table would get re-rendered automatically every time the user pressed a key. I don't know how to implement same type of functionality with RichFaces 4.

       

      I am using RichFaces 4.0.0.Final.

       

      Martin