Document Library jsNode Reference

Document created by resplin Employee on Jun 6, 2015
Version 1Show Document
  • View in full screen mode

Obsolete Pages{{Obsolete}}

The official documentation is at: http://docs.alfresco.com



4.0Developer GuideAlfresco Share






IMPORTANT
This article is for Share v4.x only and should not be used for earlier versions.

Document Library jsNode Reference


'jsNode' is the preferred object to access node properties and aspects via JavaScript on the browser.

When dealing with DataTable records, 'record.jsNode' should be available. Note: it is the responsibility of any code that updates DataTable records to also ensure the jsNode property is updated (usually within the AJAX success callback).

To create a jsNode instance, use:



   jsNode = new Alfresco.util.Node(p_node)

where p_node can either be a JavaScript object or JSON string. In either case, it should be in the format returned by the doclist-v2 data webscripts.


Methods













getNode
Returns original node object. If a JSON string was passed in, this method returns a JavaScript object.
toJSON
Return the JSON string serialization of the node.
setNodeRef
Sets a new nodeRef - doesn't requery node properties however. Used solely when generating new page urls.
hasAspect
Returns true if this node has the given aspect
hasTag
Returns true if this node has the given tag applied

Properties













































Core node properties
nodeRef
NodeRef
type
The node’s type in short QName format
isContainer
Returns true if the node is a container type
isLink
Returns true if the node is a file or folderlink type
isLocked
Returns true if the node has been locked by any user
linkedNode
If this node is a link, returns a jsNode instance of the linked node
Content nodes
contentURL
Of the format /api/node/content/{nodeRef}/{filename}
mimetype
Content mimetype
size
Content size in bytes
Properties
properties
All properties are available either via properties['my:property']

or properties.my_property

Note that 'cm:' properties are available without the prefix, e.g. 'properties.description', 'properties.title'.

Aspects
aspects
Array of aspects present on this node. See also hasAspect()
Permissions
permissions
The permissions the current user has on this node. The list of permissions is defined in the applicationScriptUtils bean configuration.
Tags
tags
Array of tags. See also hasTag()
Categories
categories
Returns an array of the format [categoryName, category path]

Attachments

    Outcomes