Hi Cagatay. Hope you are doing fine and had a great holiday.
I am again having one issue with p:tree. My tree code looks like this:
<p:tree value="#{treeBean.model}" cache="false" toggleMode="client"
onNodeClick="nodeClick" nodeSelectListener="#{treeBean.onNodeSelect}"
nodeExpandListener="#{treeBean.onNodeExpand}"
nodeCollapseListener="#{treeBean.onNodeCollapse}" widgetVar="myTree">
</p:tree>
Now
I put in <body onLoad="myTree.expandAll()".
Actually I want to populate the tree in Expanded mode at the time of page loading.
It's working in Mozilla. But in case of IE(6/7/8) it's not working. I think IE can't recognize "myTree" at the time of Body onload.
Please suggest.
Rendering problem of tree in IE
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
Hi, thanks holiday was great
To my understanding you're trying to display all nodes as expanded initially when the page is opened right?
To my understanding you're trying to display all nodes as expanded initially when the page is opened right?
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
Can you try this, let's try window onload instead of body onload.
Code: Select all
function expandAll() {
myTree.expandAll();
}
YAHOO.util.Event.addListener(window, "load", expandAll);
Hi. As per your advice, I had done the following :
javascript Methods
function expandAll()
{
myTree.expandAll();
}
window.onload=function()
{
YAHOO.util.Event.addListener("window", "load", expandAll());
}
body portion
<body>
...
...
...
<p:tree value="#{treeBean.model}" cache="false" toggleMode="client"
onNodeClick="nodeClick" nodeSelectListener="#{treeBean.onNodeSelect}"
nodeExpandListener="#{treeBean.onNodeExpand}"
nodeCollapseListener="#{treeBean.onNodeCollapse}" widgetVar="myTree">
</p:tree>
...
...
...
</body>
Still the javascript error "myTree is an undefined object" is being shown in IE; but in Mozilla, it's working fine.
Please suggest what to do.
I need your advice badly.
javascript Methods
function expandAll()
{
myTree.expandAll();
}
window.onload=function()
{
YAHOO.util.Event.addListener("window", "load", expandAll());
}
body portion
<body>
...
...
...
<p:tree value="#{treeBean.model}" cache="false" toggleMode="client"
onNodeClick="nodeClick" nodeSelectListener="#{treeBean.onNodeSelect}"
nodeExpandListener="#{treeBean.onNodeExpand}"
nodeCollapseListener="#{treeBean.onNodeCollapse}" widgetVar="myTree">
</p:tree>
...
...
...
</body>
Still the javascript error "myTree is an undefined object" is being shown in IE; but in Mozilla, it's working fine.
Please suggest what to do.
I need your advice badly.
-
- Posts: 1
- Joined: 11 Aug 2009, 15:15
The problem in IE is due to the fact that the widgetvar for tree is initialized after the containing div of the tree is ready.
One possible solution that worked for us is having an afterRender attribute for the tree component. The tree renderer puts the afterrender javascript function after the tree.render() call, thus ensuring that whatever default action on the tree is asked for (like expandAll) is called only after the widget var for tree is initialized.
One possible solution that worked for us is having an afterRender attribute for the tree component. The tree renderer puts the afterrender javascript function after the tree.render() call, thus ensuring that whatever default action on the tree is asked for (like expandAll) is called only after the widget var for tree is initialized.
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
There's a new attribute that'll be shipped with 0.9.2. Following code renders all nodes as expanded on initial page load.
Code: Select all
<p:tree expanded="true" />
-
- Information
-
Who is online
Users browsing this forum: No registered users and 20 guests