2 Replies Latest reply on Jan 17, 2012 9:52 AM by OÄŸuzhan Tortop

    Datatable fixed header

    Olivier Sabatier Newbie

      Hello,

       

      I need a datatable with a fixed header.

      I used rich:datatable because i also need group columns.

       

      And also, i can't chain an action(webflow) with the rowclick event. I tried a4j:ajax, a4j:jsFunction with no success.

       

      Anybody can help me ?

       

      Thanks

       

      Olivier

        • 1. Re: Datatable fixed header
          Mahesh Bonagiri Newbie

          Hi Sabatier,

          Welcome to the Community.

          here is the working code

          here is the working code, which will give you vertical scroll bar

          Xhtml code

          <rich:extendedDataTable value="#{test.dynamicList}" width="100px"
            height="350px" id="dynamicTable" enableContextMenu="false"
            var="fileData" reRender="dynamicScroller"
            rowClasses="datatable-odd,datatable-even"
            noDataLabel="No records Founf">

           

           

           

           

          <a4j:support event="onRowClick"
                  action="#{test.selectRow}">
                  <a4j:actionparam name="selRow" value="#{result.frmId}"
                   assignTo="#{test.selectedRow}" />
                 </a4j:support>

           


            <rich:column>
             <f:facet name="header">
              <h:outputLabel value="test header" />
             </f:facet>
             <h:outputText value="#{fileData}" />
            </rich:column>
          </rich:extendedDataTable>

           

          Managed bean code:

          import java.util.ArrayList;
          import java.util.List;

          import javax.faces.bean.ManagedBean;
          import javax.faces.bean.ViewScoped;


          @ManagedBean(name = "test")
          @ViewScoped
          public class TestManagedBean {


          private List<String> dynamicList=new ArrayList<String>();

           

           

          private String selectedRow;
          public TestManagedBean() {
            for(int i=1;i<100;i++){
             dynamicList.add(" proeprty "+i);
            }
          }


          /**
            * @return the dynamicList
            */
          public List<String> getDynamicList() {
            return dynamicList;
          }

          /**
            * @param dynamicList the dynamicList to set
            */
          public void setDynamicList(List<String> dynamicList) {
            this.dynamicList = dynamicList;
          }

          }

          • 2. Re: Datatable fixed header
            OÄŸuzhan Tortop Newbie

            hi try this it works for me for richfaces:datatable component.http://oguzhant.blogspot.com/2012/01/richfaces-datatable-fixed-header.html