vendredi 13 mars 2015

JSF binding command button in a node of treeTable dynamically

I'm creating a rootNode in backing bean dynamically. I am binding all components attributes in that node perfect without the "binding" attribute.


Here is my xhtml;



<h:form id="form">
<p:treeTable value="#{treeBean.rootNode}" var="gorev" animate="true" resizableColumns="true">
<p:column headerText="#">
<h:outputText value="#{gorev.id}" style="font-weight: bold" />
</p:column>

<p:column headerText="Görev">
<h:outputText value="#{gorev.gorevAciklama}" styleClass="wordWrap"/>
</p:column>

<p:column headerText="Sonuç">
<p:commandButton id="okBtn2" icon="tickIcon" ajax="false" binding="#{gorev.okBtn}"
action="#{treeBean.onOk(gorev)}" styleClass="iconOnlyButton" />

<p:commandButton id="cancelBtn2" icon="deleteIcon" ajax="false"
action="#{treeBean.onCancel(gorev)}"
styleClass="iconOnlyButton" />
</p:column>

<p:column headerText="Açıklama">
<p:inputText value="#{gorev.aciklama}" />
</p:column>
</p:treeTable>
</h:form>


Here is my model;



public class GorevModel implements Serializable {

private static final long serialVersionUID = -4706690834717398493L;

public GorevModel() {
}

public GorevModel(int Id, String GorevAciklama, GorevModel Gorev) {
setId(Id);
setGorevAciklama(GorevAciklama);
setGorev(Gorev);
}

private int id;
private String gorevAciklama;
private String aciklama;
private Timestamp tahminiSure;
private Timestamp baslangicTarihi;
private Timestamp bitisTarihi;
private Proje proje;
private GorevTamamlanmaTip gorevTamamlanmaTip;
private Rol rol;
private Set<GorevModel> gorevs;
private GorevModel gorev;

private HtmlCommandButton okBtn;



> //Getters Setters

}


As you can see i'm trying to bind okBtn2(binding="#{gorev.okBtn}") to representing model dynamically for each node.


I need this to setStyleClass of each commandbutton in backing dynamically.


If this kind of binding is not possible, do you have any idea how to achive to changing style of a button in a treeNode dynamically?


Aucun commentaire:

Enregistrer un commentaire