jsf 2 - Getting attribute of repeated control from JSF managed bean -


i'm using jsf + primefaces on websphere trying create stickies-like app.

i have hard time getting attributes (style position in case) repeated controls, when using ondrop listener. here code:

board.xhtml

<h:form id="mainform">     <p:datalist id="restpanel" styleclass="restrictpanel" var="note"         value="#{publicboard.getnotes()}" columns="1" type="none">         <p:panel id="note" header="#{note.title}" styleclass="smallnote"             style="#{publicboard.getnotestyle(note)}">             <h:outputtext value="#{note.description}" />         </p:panel>          <p:draggable for="note" containment="parent" opacity="0.3" />     </p:datalist>      <p:droppable for="mainform" datasource="restpanel">         <p:ajax process="@form" listener="#{publicboard.ondrop}" />     </p:droppable> </h:form> 

publicboard bean

public void ondrop(dragdropevent ddevent) {     note obj = (note) ddevent.getdata();      system.out.println("note id:" + obj.getid());     system.out.println(ddevent.getdragid());     uiviewroot viewroot = facescontext.getcurrentinstance().getviewroot();     uicomponent component = viewroot.findcomponent(ddevent.getdragid());     if(component!=null){     system.out.println(component.getid());     }else{         system.out.println("null component");     } } 

result

[22.07.15 14:27:16:094 cest] 000000c8 systemout     o note id:4 [22.07.15 14:27:16:094 cest] 000000c8 systemout     o mainform:restpanel:3:note [22.07.15 14:27:16:094 cest] 000000c8 systemout     o null component 

any appreciated!


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -