Forums : Xul, Xbl, JS...

Aller à la discussion :  Plus récente Plus ancienne

# Styler un tree via CSS

Envoyé par : Jar_Jar

Date : 22/05/2007 19:07

Bonjour, J'ai un <tree> peuplé via RDF comme ceci :

<tree datasources="rdf:null" flex="1" id="searchResults" sortResource="http://jjstream.net/rdf#id" sortDirection="ascending" hidecolumnpicker="true" ref="urn:data:row">
							<treecols>
								<treecol id="searchResCVF" label="Nom VF" sortDirection="ascending" flex="5" editable="false" />
								<treecol id="searchResCVO" label="Nom VO" flex="5" editable="false" />
								<treecol id="searchResCSet" label="Edition" flex="3" editable="false" />
								<treecol id="searchResCColor" label="Couleur" flex="2" editable="false" />
								<treecol id="searchResCRarity" label="Rareté" flex="2" editable="false" />
								<treecol id="searchResCPrice" label="Prix" flex="1" editable="true" />
								<treecol id="searchResCDispo" label="Disponibilité" flex="1" editable="true" />
								<treecol id="searchResCBuy" label="Achat" flex="1" editable="true" />
								<treecol id="searchResCBuyP" label="Prix d'achat" flex="1" editable="true" />
								<treecol id="searchResCNew" label="Nouveauté" flex="2" editable="true" />
							</treecols>
							<template>
								<treechildren alternatingbackground="true">
									<treeitem height="20" uri="rdf:*" cid="rdf:http://jjstream.net/rdf#id">
										<treerow properties="rdf:http://jjstream.net/rdf#cssColor">
											<treecell label="rdf:http://jjstream.net/rdf#vf" />
											<treecell label="rdf:http://jjstream.net/rdf#vo" />
											<treecell label="rdf:http://jjstream.net/rdf#set" />
											<treecell label="rdf:http://jjstream.net/rdf#color" />
											<treecell label="rdf:http://jjstream.net/rdf#rarity" />
											<treecell label="rdf:http://jjstream.net/rdf#price" />
											<treecell label="rdf:http://jjstream.net/rdf#dispo" />
											<treecell label="rdf:http://jjstream.net/rdf#buy" />
											<treecell label="rdf:http://jjstream.net/rdf#buyPrice" />
											<treecell label="rdf:http://jjstream.net/rdf#new" />
										</treerow>
									</treeitem>
								</treechildren>
							</template>
						</tree>

La cssColor de

<treerow properties="rdf:http://jjstream.net/rdf#cssColor">

peur être par exemple "green" mais bien sur autre chose, et en fait ce que je voudrais faire, c'est arriver à changer la couleur de la police des cellules de la ligne selectionnée si celle ci est de "properties green"

J'ai tenté :

treechildren::-moz-tree-row(green)::-moz-tree-cell-text(selected)

ou

treechildren::-moz-tree-row(green) -moz-tree-cell-text(selected)

etc, ...

Mais rien ne marche, il n'est pas possible de faire 2 niveaux de sélection via les sélécteurs spéciaux des tree ?

Merci beaucoup!

# Re: Styler un tree via CSS

Envoyé par : mistervince

Date : 23/05/2007 09:28

salut,

j'avoue ne pas pouvoir répondre à la question générale sur les niveaux de sélection via sélecteurs spéciaux mais je peux te proposer une solution pour ton problème.

Il faut ajouter la properties cssColor aux treecell de ton template (et plus sur le treerow) :

<template>
    <treechildren alternatingbackground="true">
         <treeitem height="20" uri="rdf:*"   id="rdf:http://jjstream.net/rdf#id">
               <treerow>
                  <treecell label="rdf:http://jjstream.net/rdf#vf" properties="rdf:http://jjstream.net/rdf#cssColor"/>
                  <treecell label="rdf:http://jjstream.net/rdf#vo" properties="rdf:http://jjstream.net/rdf#cssColor"/>
                  <treecell label="rdf:http://jjstream.net/rdf#set" properties="rdf:http://jjstream.net/rdf#cssColor"/>
                  <treecell label="rdf:http://jjstream.net/rdf#color" properties="rdf:http://jjstream.net/rdf#cssColor"/>
                  <treecell label="rdf:http://jjstream.net/rdf#rarity" properties="rdf:http://jjstream.net/rdf#cssColor"/>
                  <treecell label="rdf:http://jjstream.net/rdf#price" properties="rdf:http://jjstream.net/rdf#cssColor"/>
                  <treecell label="rdf:http://jjstream.net/rdf#dispo" properties="rdf:http://jjstream.net/rdf#cssColor"/>
                  <treecell label="rdf:http://jjstream.net/rdf#buy" properties="rdf:http://jjstream.net/rdf#cssColor"/>
                  <treecell label="rdf:http://jjstream.net/rdf#buyPrice" properties="rdf:http://jjstream.net/rdf#cssColor"/>
                  <treecell label="rdf:http://jjstream.net/rdf#new" properties="rdf:http://jjstream.net/rdf#cssColor"/>
         </treerow>
     </treeitem>
</treechildren>
</template>

et mettre la règle css suivante :

#searchResults treechildren::-moz-tree-cell-text(green, selected) {
     color: green;
}

vincent
novatice.org

# Re: Styler un tree via CSS

Envoyé par : Jar_Jar

Date : 13/06/2007 22:01

Ca marche, merci beaucoup!

Il n'est plus possible de poster des messages dans ce forum.


Copyright © 2003-2013 association xulfr, 2013-2016 Laurent Jouanneau - Informations légales.

Mozilla® est une marque déposée de la fondation Mozilla.
Mozilla.org™, Firefox™, Thunderbird™, Mozilla Suite™ et XUL™ sont des marques de la fondation Mozilla.