3 Replies Latest reply on Jun 3, 2008 8:58 AM by Ilya Shaikovsky

    <rich:scrollableDatatable> selection

    k dcosta Newbie


      I am using a rich scrollable Datatable in my application.This table is populated according from a database, according to the value selected from a combo box.

      ie when the page is loaded, the grid is empty.Then the user selected a value from the combo box and at the backend, it fetches the value from the database and bind to the list and rerenders the grid to show the fetched value.

      In my datatable i have binded the selection attribute. My datatable contains a rich column and in it a button is there.And when the button is selected the it calls a take selection method. and i want to show the selected row values in the text boxes.

      <rich:scrollableDataTable value="#{programManager.listType}" var="program"
       width="100%" height="260px" rowKeyVar="rkv" rows="10"
       id="pgmList" rowClasses="row1,row2"
       <rich:column width="97" id="select" headerClass="listhead"
       sortable="false" >
       <f:facet name="header" >
       <h:outputText value="Select" />
       <h:commandButton id="btnSelection"
       <a4j:support event="onclick" reRender="formPanel"></a4j:support>
       <rich:column width="220" id="pgmid" headerClass="listhead"
       sortable="false" >
       <f:facet name="header">
       <h:outputText value="#{programManager.id}" id="h_proId" />
       <h:outputText value="#{program.programID}" id="proId"></h:outputText>

      public String takeSelection() {
       System.out.println("inside take selection");
       try {
       Iterator<Object> iterator = programBean.getSelection().getKeys();
       while (iterator.hasNext()) {
       SimpleRowKey key = (SimpleRowKey) iterator.next();
       } catch (Exception e) {
       return null;

      My problem is
      When i select the value from the combo, the grid id populated correctly. and when i select the button in the table, first time its not going to the takeSelection() method binded to it and the grid values get disappear.after that when the value selected from combo, the grid again get populated and when i click the button , the grid is getting selected, but it shows the values of previous selection. it continues like this.

      Why is it so????
      i dono whether i have conveyed my problem correctly.
      If someone have any idea, plz help me.