6 Replies Latest reply on Jan 10, 2008 9:16 PM by Xuan Toan

    Can not save ListShuttle status when change sourcelist, acti

    Xuan  Toan Newbie

      Because there is few problem of listshuttle when sourcelist is very great so I must use a filter for sourcelist. However i can not get action (Save) after filter.
      My jsp

      <%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
      <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
      <%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt"%>
      <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
      <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
      <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
       <f:view>
      
       <h:form>
       <h:commandButton action="#{TestBean.actionFilter}" value="Filter" />
       </h:form>
       <h:form id="form1">
       <h:panelGrid columns="1">
       <h:column>
       <rich:listShuttle sourceValue="#{TestBean.clipbeans}"
       targetValue="#{TestBean.folder}" var="items"
       sourceCaptionLabel="Kho Clips"
       targetCaptionLabel="Folder" converter="listShuttleconverter" id="idList" sourceListWidth="100%" targetListWidth="100%" >
       <rich:column width="20">
       <f:facet name="header">
       <h:outputText value="test" />
       </f:facet>
       <h:outputText value="#{items.clipID}"></h:outputText>
       </rich:column>
       <rich:column width="20">
       <f:facet name="header">
       <h:outputText value="test" />
       </f:facet>
       <h:outputText value="#{items.cateName}"></h:outputText>
       </rich:column>
      
       </rich:listShuttle>
      
       </h:column>
       <h:column>
       <h:commandButton action="#{TestBean.actionSave}" value="Save" />
       </h:column>
       </h:panelGrid>
       </h:form>
       </f:view>
      


      My Item

      public class ClipBean {
       /**
       *
       */
       private String clipID;
       private String cateName;
      
       public ClipBean(){
       }
       public ClipBean(String clipId,String cateName){
       this.setCateName(cateName);
       this.setClipID(clipId);
       }
       public String getCateName() {
       return cateName;
       }
       public void setCateName(String cateName) {
       this.cateName = cateName;
       }
       public int hashCode() {
       final int prime = 31;
       int result = 1;
       result = prime * result + ((clipID == null) ? 0 : clipID.hashCode());
       result = prime * result + ((cateName == null) ? 0 : cateName.hashCode());
       return result;
       }
      
       public boolean equals(Object obj) {
       if (this == obj)
       return true;
       if (obj == null)
       return false;
       if (getClass() != obj.getClass())
       return false;
       final ClipBean other = (ClipBean) obj;
       if (clipID == null) {
       if (other.clipID != null)
       return false;
       } else if (!clipID.equals(other.clipID))
       return false;
       if (cateName == null) {
       if (other.cateName != null)
       return false;
       } else if (!cateName.equals(other.cateName))
       return false;
       return true;
       }
       public String getClipID() {
       return clipID;
       }
       public void setClipID(String clipID) {
       this.clipID = clipID;
       }
      
      }
      
      


      My Bean

      public class TestBean {
      
       ArrayList clipbeans;
       ArrayList folder;
       /**
       *
       */
       public TestBean() {
       // TODO Auto-generated constructor stub
       clipbeans=new ArrayList(200);
       folder=new ArrayList(100);
       for (int i=0;i<200;i++){
       ClipBean cl=new ClipBean();
       cl.setCateName("test_"+i);
       cl.setClipID("aaa");
       clipbeans.add(cl);
       }
       }
       public ArrayList getClipbeans() {
       return clipbeans;
       }
       public void setClipbeans(ArrayList clipbeans) {
       this.clipbeans = clipbeans;
       }
       public ArrayList getFolder() {
       return folder;
       }
       public void setFolder(ArrayList folder) {
       this.folder = folder;
       }
       public void actionFilter(){
       System.out.println("Filter");
       clipbeans=new ArrayList(200);
       folder=new ArrayList(100);
       for (int i=0;i<200;i++){
       ClipBean cl=new ClipBean();
       cl.setCateName("Filter_"+i);
       cl.setClipID("123");
       clipbeans.add(cl);
       }
       }
       public void actionSave(){
       System.out.println("save");
       }
      
      }
      
      


      I can understand. Please help me. Thanks