cancel
Showing results for 
Search instead for 
Did you mean: 

Get NodeRef from nodes array.

aditya_chaudhar
Champ on-the-rise
Champ on-the-rise
Hi Everyone ,
i want to get node ref link from tag  so i did as follows

var store = "workspace://SpacesStore";
var tag = "sampletag";

var nodes = search.tagSearch(store, tag);


the above nodes gives me array of tag :

nodes[0] gives me 
{http://www.alfresco.org/model/content/1.0}content Node Ref: workspace://SpacesStore/3177d3fa-be03-4683-9c5f-74133d4b07d5

But i want only Node Ref from it (i.e. workspace://SpacesStore/3177d3fa-be03-4683-9c5f-74133d4b07d5 )

I tries using  indexOf of javascript it did not work .

Can anyone please help me on how i can get only noderef from array of nodes.???


Thanks and Regards
Aditya C
3 REPLIES 3

lementree
Champ on-the-rise
Champ on-the-rise
Hi,

can you try nodes[0].nodeRef

Regards

Hi lementree ,
Thank you for your reply
It works
Also i have used below
var aaaa=nodes[0].url;
which gives me path which i then manipulate and used as per my requirment

So for others who are reading this post below are two ways to get NodeRef from nodes array.
var aaaa=nodes[0].url;
var bbb=nodes[0].nodeRef

both of this gives different OP use and custamize as per your need.

lementree , Thanks again for valuable feedback.
Thanks and Regards
Aditya C Chaudhari

s_palyukh
Star Contributor
Star Contributor
Hi,

The method search.tagSearch(store, tag) returns array of ScriptNode objects. This object has a lot of useful methods.

You can see all allowed methods and fields by the following url http://docs.alfresco.com/4.1/references/API-JS-ScriptNode.html