Tree doesn't work with 2.0.2

UI Components for JSF
Post Reply
User avatar
Oleg
Expert Member
Posts: 3805
Joined: 02 Oct 2009, 09:41
Location: Germany, Black Forest

25 May 2010, 17:21

Hello Cagatay,

My tree doesn't work more after update to PrimeFaces 2.0.2. No expand, no select more. I have figured out I need selection="single" (was not nessesary with 2.0.1), but PrimeFacesPhaseListener says after its adding "tree id is not found to be updated partially". The tree:

Code: Select all

<p:tree id="treeSocs" value="#{socsBean.socsRootNode}" var="socNode" dynamic="true" cache="true"
	selectionMode="single" nodeSelectListener="#{socsBean.onNodeSelect}" nodeExpandListener="#{socsBean.onNodeExpand}"
	update="dtSelTreeSocGroup,dtSocsGroup,mbPropDefs" onNodeClick="handleTreeSocsNodeClick" widgetVar="treeSocsWidget">
	<p:treeNode>
		<h:outputText value="#{socNode.displayName}" escape="false"/>
	</p:treeNode>
	<p:treeNode type="leafSoc" styleClass="leafSoc">
		<h:outputText value="#{socNode.displayName}" styleClass="leafContent" escape="false"/>
	</p:treeNode>
</p:tree>
Please, give me a hint what is wrong here.

The next problem - the entire tree is selected (green).
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin

User avatar
Oleg
Expert Member
Posts: 3805
Joined: 02 Oct 2009, 09:41
Location: Germany, Black Forest

25 May 2010, 17:40

I have found I need "selection" as well.

Code: Select all

selection="#{socsBean.selectedNodes}"
This is a little bit strange for me because I set selected node in the nodeSelectListener.

I assume, the reason why the entire tree is green is the selection again. If no node is selected the entire tree is selected. Right? How can we avoid this behavior? I don't want to select any nodes if no selection is available.
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin

User avatar
Oleg
Expert Member
Posts: 3805
Joined: 02 Oct 2009, 09:41
Location: Germany, Black Forest

26 May 2010, 09:29

Do I see right that pre-selection doesn't work although we have "selection" attribute? What is this attribute then good for? Note: I don't have checkboxes. Selection mode is "single". By the way, for pre-selection you can use my patch.

I have found why my tree is green. In the TreeRenderer (encodeMarkup) you have

Code: Select all

		if(selectionEnabled) {
			String selectionClass = tree.getSelectionMode().equalsIgnoreCase("checkbox") ? "ygtv-checkbox" : "ygtv-highlight";
			writer.writeAttribute("class", selectionClass, null);
		}
ygtv-highlight has green color in my CSS.

I have adjusted now my tree to all changes in 2.0.2. One thing is still not nice - selection occupies the entire row and not label only. You can see this here http://www.primefaces.org:8080/prime-sh ... Single.jsf.
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

29 May 2010, 12:04

Hi Oleg,

Tree selection is rewritten now it supports single, multiple, checkbox and instant single ajax selection so we had to move thing around a little bit. Check out the showcase examples or the user's guide for the new usage. We'll create a migration guide for each release from now on and document the parts that are not backward compatible starting from next release.

You are confusing node focus (old selection, remember it was disappearing) and node selection (highlighting, new way). Focus and Highlight are different things. Highlight is permanent and focus is not.

I can't seem to replicate the whole green issue, what should I do to replicate it, which browser are you testing with?

By default, when a tree is selected (highlighted) whole row gets blue background, this is the default YUI skin which is easy to customize, check out the style selectors;

http://developer.yahoo.com/yui/treeview/#style

User avatar
Oleg
Expert Member
Posts: 3805
Joined: 02 Oct 2009, 09:41
Location: Germany, Black Forest

29 May 2010, 18:45

cagatay.civici wrote:Hi Oleg,

Tree selection is rewritten now it supports single, multiple, checkbox and instant single ajax selection so we had to move thing around a little bit. Check out the showcase examples or the user's guide for the new usage. We'll create a migration guide for each release from now on and document the parts that are not backward compatible starting from next release.

You are confusing node focus (old selection, remember it was disappearing) and node selection (highlighting, new way). Focus and Highlight are different things. Highlight is permanent and focus is not.

I can't seem to replicate the whole green issue, what should I do to replicate it, which browser are you testing with?

By default, when a tree is selected (highlighted) whole row gets blue background, this is the default YUI skin which is easy to customize, check out the style selectors;

http://developer.yahoo.com/yui/treeview/#style
Hello Cagatay,

I'm glad to hear that you will create a mirgation guide in the feature releases. My problem was my CSS. I have adjusted it and it's working now (no green color for entire tree). Default YUI behavior with row selection is adjusted in my CSS as well so that I have just label selection. It seems to be nicer for me. For this issue http://primefaces.prime.com.tr/forum/vi ... f=3&t=2506 I have found a workaround too.

Thanks a lot for your effort.
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

30 May 2010, 15:29

Glad to hear you migrated to new tree Oleg.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 14 guests