This might be a long shot since you are asking for clientside funtionality, but when you have the nodeId you can easily lookup the ContentType before doing anything else with it - this is done like:
Content c = new Content(1046, false); ContentType type = c.ContentType;
Constructor taking an integer or guid and then true/false for setup.
The following classes derive from Content: ContentItem Document Media Member
Or you could load it as a CMSNode object, which is the base for almost everything in Umbraco and then use the Guid from the nodeObjectType to load the ContentType like this:
CMSNode node = new CMSNode(1046); Guid cId = nodeObjectType; ContentType type = new ContentType(cId, false);
That would work if I was only worried about Content and Media nodes.. I need it to work for all nodes.. including ones in Settings, Developer, User and Member.
Need nodeType of action node on client side
I know I can get nodeId with UmbClientMgr.mainTree().actionNode().nodeId;
How do I get the nodeType?
Tried UmbClientMgr.mainTree().actionNode().nodeType; but get error saying nodeType is not valid property (paraphrased).
Any alternatives would be appreciated.
Thanks!
I can get the nodeId from the query string, but I won't know what tree it's associated with.
Was hoping to use this:
.. but it's only valid if i am calling an action on a node (i.e. context menu).
I actually need the nodeType of the currently selected node of any tree. (i.e. when node is clicked)
Hi Daniel,
This might be a long shot since you are asking for clientside funtionality, but when you have the nodeId you can easily lookup the ContentType before doing anything else with it - this is done like:
Content c = new Content(1046, false);
ContentType type = c.ContentType;
Constructor taking an integer or guid and then true/false for setup.
The following classes derive from Content:
ContentItem
Document
Media
Member
- Morten
Or you could load it as a CMSNode object, which is the base for almost everything in Umbraco and then use the Guid from the nodeObjectType to load the ContentType like this:
CMSNode node = new CMSNode(1046);
Guid cId = nodeObjectType;
ContentType type = new ContentType(cId, false);
- Morten
That would work if I was only worried about Content and Media nodes.. I need it to work for all nodes.. including ones in Settings, Developer, User and Member.
I ended up doing this:
var currentNodeType;
$('li.loaded a').live('mouseover', function () {
currentNodeType = $(this).parent().attr('umb:type');
});
It's not perfect, but it gives me the nodeType that the mouse is over just before the click.
I can then pass the value to my function that calls to the server..
is working on a reply...