DropListener doesn't work when using <rich:extendedDataTable
alaal May 21, 2009 11:17 PMHi everyone:
I have one drag-drop issue on <rich:extendedDataTable>, i'm using MyFaces 1.2.6, Facelet 1.1.14, Richfaces 3.3.0 here's my codes
allUsers.xhtml:
<!-- extendedDataTable --> <rich:extendedDataTable value="#{allUser.allUsersModel}" var="user" id="allUser" width="440px" rows="10" sortMode="#allUser.sortMode}" selectionMode="#{allUser.selectionMode}"> <rich:column label="User Name" sortable="true" sortBy="#{user.userName}" filterBy="#{user.userName}" filterEvent="onkeyup"> <f:facet name="header"> <h:outputText value="User Name" /> </f:facet> <rich:dragSupport dragIndicator=":indicator" dragType="user" dragValue="#{user}"> <rich:dndParam name="label" value="#{user.userName}" /> </rich:dragSupport> <h:outputText value="#{user.userName}" /> </rich:column> </rich:extendedDataTable> <!-- drop zone --> <rich:panel styleClass="dropTargetPanel"> <f:facet name="header"> <h:outputText value="users" /> </f:facet> <rich:dropSupport id="user" acceptedTypes="user" dropValue="user" dropListener="#{eventBean.processDrop}"> </rich:dropSupport> </rich:panel>
back bean
private ExtendedTableDataModel<UserInterface> mAllUsersModel; private List<UserInterface> mAllUsersList = null; public ExtendedTableDataModel<UserInterface> getAllUsersModel() { mAllUsersList = UserManager.getInstance().getLatestUserInfo(); mAllUsersModel = new ExtendedTableDataModel<UserInterface>( new DataProvider<UserInterface>() { private static final long serialVersionUID = 5054087821033164847L; public UserInterface getItemByKey(Object key) { for (UserInterface c : mAllUsersList) { if (key.equals(getKey(c))) { return c; } } return null; } public List<UserInterface> getItemsByRange(int firstRow, int endRow) { return mAllUsersList.subList(firstRow, endRow); } public Object getKey(UserInterface item) { return item.getUserCode(); } public int getRowCount() { return mAllUsersList.size(); } }); } public List<UserInterface> getAllUsersList() { return mAllUsersList; }
EventBean:
public class EventBean implements DropListener { ... public void processDrop(DropEvent dropEvent) { Dropzone dropzone = (Dropzone) dropEvent.getComponent(); } ... }
extendedDataTable is value binded on mAllUsersModel which is a instance of ExtendedTableDataModel,
when i drop object on drop-zone , method processDrop(DropEvent dropEvent) on EventBean havn't been called
, if ExtendedTableDataModel is binded on mAllUsersList which is a List and use rich:dataTable , everyting goes well
i'm really appreciate if anyone could tell me what's the problem, thanks