cancel
Showing results for 
Search instead for 
Did you mean: 

How to set icon in JavaScript?

stk137
Champ in-the-making
Champ in-the-making
How do you set the icon in JavaScript?

the icon properties that I see (node.icon16, node.icon32) are read only.

thx
6 REPLIES 6

kevinr
Star Contributor
Star Contributor
The icon for a file is derived from the extension. The icon for a space can be set as a property - but only to the specific set of icons you see in the web-client unless you are going to add a bunch of new icons…?

Thanks,

Kevin

tfpadilla
Champ in-the-making
Champ in-the-making
Hi,
I am new in Alfresco, so , please, help me to solve this.

I'd like to change the icon space when a specific file arrives. I have created an inbound rule that runs an script for it.

Inside the script I write ( for example):

space.properties["app:icon"]="space-icon-doc";
I don't get any error but the icon DOESN'T change and continues with "space-icon-default".

What am I doing wrong?
Thanks in advance

kevinr
Star Contributor
Star Contributor
Have you tried this?

space.properties["app:icon"]="space-icon-doc";
space.save();

Kev

tfpadilla
Champ in-the-making
Champ in-the-making
Now I feel stupid. Smiley Surprisedops:

Thanks a lot, kevinr

vibhutewary
Champ in-the-making
Champ in-the-making
Hello,
I hope someone might find this useful to create a custom space icon :

<!– Example of adding a custom icon to the Create Space dialog –>
<config evaluator="string-compare" condition="cm:folder icons">
  <icons>
    <icon name="space-icon-custom" path="/images/icons/space-icon-custom.gif" />
  </icons>
</config>

note this was'nt working for me earlier (with space-icon-custom.gif named as space-icon-custom1.gif)

Regards,
Vibhu.

vibhutewary
Champ in-the-making
Champ in-the-making
Hello,
I hope someone might find this useful to create a custom space icon :

 <!– Example of adding a custom icon to the Create Space dialog –>
<config evaluator="string-compare" condition="cm:folder icons">
  <icons>
    <icon name="space-icon-custom" path="/images/icons/space-icon-custom.gif" />
  </icons>
</config>

note this was'nt working for me earlier (with space-icon-custom.gif named as space-icon-custom1.gif)

Regards,
Vibhu.