cancel
Showing results for 
Search instead for 
Did you mean: 

Client-side javascript document properties

joaotpd
Champ on-the-rise
Champ on-the-rise
Hi all!

How can I get properties from a document in a client-side javascript? Do I need to create a Webscript for that?! …

Thanks in advance! …

João
2 REPLIES 2

mikeh
Star Contributor
Star Contributor
Yes. Your webscript would return the properties as a JSON string. You use one of the many frameworks available (e.g. YUI) to convert that string into native JavaScript objects.

Thanks,
Mike

joaotpd
Champ on-the-rise
Champ on-the-rise
Hi Mike!

Many thanks for your response… I did just that… but in my doc-props.get.js (server-side) I can only access one property at a time…

… this works:


var current = [];

current.push(
{
   propName: "description",
   propValue: node.properties["{http://www.alfresco.org/model/content/1.0}description'].toString()
});

but this don't:


var current=[], key, name, value, properties = node.properties.toArray();
  
for (key in properties)
   {
         name = key;
         value = node.properties[key];
      current.push
      ({
         propName: name,
         propValue: value
      });
   }

I get this: "TypeError: toArray is not a function, it is null." …

How to access properly to the properties array of a node?! …

Thanks again! …