im currently developing my first jsf webapplication and at the very beginning i want to say tanks a lot to optimus and all the guys who support primefaces.
I want to get the value of the draged object and i have absolutly no idear how to solve this.
Here's my code:
Later it should merge the content of the draged and droped items but that will be no problem. My only problem is to get the #{album.id} in my bean.
Code: Select all
<p:dataGrid value="#{albumController.currentUserAlbums}" var="album" columns="4" rows="12" paginator="true" effect="true" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="15,30">
<p:column>
<p:commandLink action="#" oncomplete="imageDialogWidget.show()" update="albumDialogFormular">
<f:param id="albumId" value="#{album.id} />
<p:droppable dropListener="#{manageAlbums.onDrop}" tolerance="intersect" />
<p:draggable revert="true" zindex="1000" />
<p:graphicImage url="#{resource['img/manageAlbums/folder.png']}" width="130" style="border:0px;" />
</p:commandLink>
</p:column>
</p:dataGrid>
my bean looks like this:
Code: Select all
@ManagedBean(name = "manageAlbums")
@SessionScoped
public class ManageAlbums implements Serializable {
private Album dragedAlbum;
private Album targetAlbum;
/*
some irrelevant stuff
....
*/
public void onDrop(DragDropEvent ddEvent) {
System.out.println("test1: " + ddEvent.getDragId());
System.out.println("test2: " + ddEvent.getDropId());
}
}
so my first approach was simply to set the id of the wrapped element to the album id value but this is not posibile because it's in a loob and jsf ignores the value.
Code: Select all
<p:dataGrid value="#{albumController.currentUserAlbums}" var="album" columns="4" rows="12" paginator="true" effect="true" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="15,30">
<p:column>
<p:commandLink id="#{album.id}" action="#" oncomplete="imageDialogWidget.show()" update="albumDialogFormular">
<p:droppable dropListener="#{manageAlbums.onDrop}" tolerance="intersect" />
<p:draggable revert="true" zindex="1000" />
<p:graphicImage url="#{resource['img/manageAlbums/folder.png']}" width="130" style="border:0px;" />
</p:commandLink>
</p:column>
</p:dataGrid>
I'm using jsf 2.0 and primefaces 2.1rc1 running on glasfish v3, but i think the only interesting information about my problem ist the primefaces version
thanks and best regards
matthias