myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From S├ębastien Marin <the.ma...@free.fr>
Subject Re: "Null child not allowed" on the TreeTable
Date Thu, 29 Dec 2005 08:16:13 GMT
Why do you want to insert your treeTable on a DataTable ?
The treeTable component do it for you :

<x:tree id="tree" value="#{detailPerspectiveIntervenantTree}"
            var="composite"
            styleClass="tree"
            nodeClass="treenode"
            headerClass="treeHeader"
            footerClass="treeFooter"
            rowClasses="a, b"
            columnClasses="col1, col2"
            selectedNodeClass="treenodeSelected"
            expandRoot="true">
    <h:column>
        <f:facet name="header">
                <h:outputText value="Nom" />
        </f:facet>
        <h:outputText value="#{composite.nom}" />
    </h:column>
    <x:treeColumn>
        <f:facet name="header">
            	<h:outputText value="Prenom" />
    	</f:facet>
        <h:outputText value="#{composite.prenom}" />
    </x:treeColumn>
    <h:column>
        <f:facet name="header">
                <h:outputText value="Age" />
        </f:facet>
        <h:outputText value="#{composite.age}" />
    </h:column>
    <f:facet name="footer">
        <h:outputText value="Footer" />
    </f:facet>
</x:tree>

On this exemple, the treeTable make a table with 3 columns. The tree is insert
on the second column.



Selon Nikita Shah <nikita_h_shah@yahoo.com>:

->  Hello Sebastein,
->
-> Did you have a workaround for the problem you were facing of null child..?
->   I am also using the MyFaces treeTable component. I have  a list of tasks
-> and their subtasks. I want to display task as the root  node and sub-tasks
-> as its children.
->
->   Following is my jsp page -
->
->   <t:dataTable id="taskTable" styleClass="taskTable"
->       rowClasses="taskTable_Row1,taskTable_Row2" var="task"
-> columnClasses="task_nodeColumn,task_groupColumn,task_weightColumn"
->       value="#{projectLeaf.tasks}">
->
->   <t:column>
->       <t:tree id="tree" value="#{task.subTaskTree}"
->                             var="treeItem" expandRoot="true">
->         <t:treeColumn>
->              <f:facet name="header">
->                   <h:outputText value="Header 2" />
->              </f:facet>
->              <h:outputText value="#{treeItem.name}" />
->          </t:treeColumn>
->
->       </t:tree>
->   </t:column>
->   <t:column>
->           <f:verbatim><b>Participants</b><br></f:verbatim>
->   </t:column>
->   </t:dataTable>
->
->   The bean method is as below -
->
->   public DefaultTreeModel getSubTaskTree()
->           {
->           DefaultMutableTreeNode root = new DefaultMutableTreeNode(new
-> Task(1,"root"));
->           DefaultMutableTreeNode a = new DefaultMutableTreeNode(new Task(2,
-> "A"));
->           root.insert(a);
->           DefaultMutableTreeNode b = new DefaultMutableTreeNode(new Task(3,
-> "B"));
->           root.insert(b);
->           DefaultMutableTreeNode c = new DefaultMutableTreeNode(new Task(4,
-> "C"));
->           root.insert(c);
->   DefaultTreeModel treeModel = new DefaultTreeModel(root);
->           return treeModel;
->       }
->
->   I get the following error
->   Base is null: task
->
->   Wud appreciate your help if you have come across such error or have any
-> idea.
->
->   TIA
->   Nikita
->
->
->
-> ---------------------------------------------------------------------
-> Ability is what you're capable of.
-> Motivation determines what you do.
-> Attitude determines how well you do it.
->
-> ---------------------------------
-> Yahoo! Shopping
->  Find Great Deals on Holiday Gifts at Yahoo! Shopping


|Cordialement, S├ębastien MARIN.|
|------------------------------|
|->  http://www.marin-s.com  <-|
|------------------------------|

Mime
View raw message