1 Reply Latest reply on Jan 22, 2014 11:30 AM by 222222

    ExtendedDataTable and select selection="#{userBean.selection}" selection==null

    222222

      richface 4.3.4 JBoss EAP 6.1

      *.xhtml

      <rich:extendedDataTable id="table" value="#{UserBean.arl}" var="var0" style="height:300px; width:500px;"

      clientRows="0" selection="#{userBean.selection}" selectionMode="single">

      *

      *

      -----------------------------------------------------------------------------------------------------------------------------------------------------------------

      @ManagedBean

      @SessionScoped

      public class UserBean implements Serializable, ActionListener{

       

      public Collection<Object> selection ;

      public List<tableItem>  arl;

      public Collection<Object> getSelection() {

              return selection;

          }

       

          public void setSelection(Collection<Object> selection) {

              this.selection = selection;

          }

       

          public synchronized List<tableItem> getArl() {
              if(null==this.arl )
              {
                  this.arl=new ArrayList<tableItem>();
                  for(int i=0;i<100;i++)
                  {
                      tableItem it=new tableItem(String.valueOf(i), String.valueOf(i));
                      it.setA0(String.valueOf(i));
                      this.arl.add(it);
                  }
              }
              return this.arl;
          }
          public void setArl(List<tableItem> arl) {
              this.arl = arl;
          }

      };

      --------------------------------------------------------------------------------------------------------------------------------

      public class tableItem implements Serializable{

       

          private static final long serialVersionUID = 5010664822128552977L;

         

         

      public String a0;

      public String a1;

       

      public tableItem() {

          super();

          this.a0 = "**-";

          this.a1 = "**-";

      }

       

       

      public tableItem(String a0, String a1) {

          super();

          this.a0 = a0;

          this.a1 = a1;

      }

       

       

      public String getA0() {

          return a0;

      }

       

       

      public void setA0(String a0) {

          this.a0 = a0;

      }

       

       

      public String getA1() {

          return a1;

      }

       

       

      public void setA1(String a1) {

          this.a1 = a1;

      }

      --------------------------------------------------------------------------------------------------------------------------------------------------

       

      when i select row selection not initial. selection==null. why? help please

        • 1. Re: ExtendedDataTable and select selection="#{userBean.selection}" selection==null
          222222

          <h:form>

          <rich:extendedDataTable id="table" value="#{userBean.arl}" var="var0" style="height:300px; width:500px;"

          clientRows="0" selection="#{userBean.selection}" selectionMode="single">

           

          <a4j:ajax execute="@form" event="selectionchange" render="name000, panel" listener="#{userBean.selectionListener}"/>

                                 

              <f:facet name="caption">

                  <h:outputText value="название таблицы" />

              </f:facet>

              <f:facet name="header">

                  <h:outputText value="шапка0" />

              </f:facet>  

              <rich:column id="c_one" sortBy="#{var0.a0}" sortOrder="#{userBean.sortsOrders['one']}" sortType="custom">

                  <f:facet name="header">

                  <a4j:commandLink execute="@this" value="колонка1" render="table" action="#{userBean.sort}">

                  </a4j:commandLink>

                 </f:facet>

                      <h:outputText value="#{var0.a0}"/>

                  <f:facet name="footer">низ колонки1</f:facet>

              </rich:column>

           

              <rich:column>

                  <f:facet name="header">колонка2</f:facet>

                      <h:outputText value="#{var0.a1}"/>

                  <f:facet name="footer">низ колонки2</f:facet>

              </rich:column>

           

              <f:facet name="footer">

                  <h:outputText value="низ таблицы" />

              </f:facet>

           

          </rich:extendedDataTable>

           

          <h:inputText id="name00" value="#{userBean.singleItemSel.a0}" rendered="#{not empty userBean.selection}"></h:inputText>

          <h:outputText  id="name000" value="#{userBean.singleItemSel.a0}" />

           

          <a4j:commandButton value="Show Current Selection"  render="name000">

          <rich:componentControl target="panel" operation="show" />

          </a4j:commandButton>

           

          <h:commandButton value="Show Current Selection2">

          <f:ajax render="name000"/>

          <a4j:actionListener listener="#{userBean.processAction}"/>

          </h:commandButton>

          </h:form> 

          fine work :-)