Can't identify document objects for Context Menus in SharePoint Lists
I'm trying to use JavaScript to find the context menu items being shown and selected from the lists (such as a document library) in SharePoint. I've tracked down a few different function names within core.js, (such as DispEx() and CMOpt()) but I really am having a hard time following the unhelpful variable name mess.
My understanding is that the context menu has to exist within the DOM somewhere - I just can't find out how to retrieve/reference it.
Thanks in advance - this is driving me 开发者_如何转开发nuts!
EDIT: I've tried traversing all children from onclick="return DispEx(...)" and I'm not getting anything! This is what I've used to capture that info:
' 'function findStuff(){ var something; $('[onclick*=DispEx]').children().each(function(){ something = something + this.tagName + '\n'; }); alert(something);
}
It looks like those dom elements might be generated by javascript. Take a look at this article.
Also, you might be able to find the element id's by just searching the dom for text using the contains
selector:
$(":contains('context menu item text')").attr('id')
I ended up using an element tracking plug-in to track commonalities between three different installations of SharePoint to get a rough general case. However, I was unable to avoid needed some configuration tailored to the install :(
精彩评论