|
10.02.2010, 13:05 | #1 |
Участник
|
CRM DE LA CREME! Hides the associated Views buttons/More Actions menu drop down
Источник: http://crmdelacreme.blogspot.com/201...ttonsmore.html
============== /* Hides the associated Views buttons. i.e Hides the add existing button. */ /* NB: If called multiple times, the settings of the previous calls are overwritten by the final one! */ /* A menu element on the "More actions" drop-down menu can be hidden * by adding a string such as 'More Actions::Activate' to the buttonTitles array. */ HideAssociatedViewButtons = function(loadAreaId, buttonTitles) { var navElement = document.getElementById('nav_' + loadAreaId); if (navElement != null) { navElement.onclick = function LoadAreaOverride() { // Call the original CRM method to launch the navigation link and create area iFrame loadArea(loadAreaId); HideViewButtons(document.getElementById(loadAreaId + 'Frame'), buttonTitles); } } } /* Used internally by the 'HideAssociatedViewButtons' method */ HideViewButtons = function(Iframe, buttonTitles) { if (Iframe != null) { Iframe.onreadystatechange = function HideTitledButtons() { if (Iframe.readyState == 'complete') { var iFrame = frames[window.event.srcElement.id]; var liElements = iFrame.document.getElementsByTagName('li'); for (var j = 0; j < buttonTitles.length; j++) { buttonTitleParts = buttonTitles[j].split('::'); if (buttonTitleParts.length > 0) { buttonTitle = buttonTitleParts[0]; for (var i = 0; i < liElements.length; i++) { liElement = liElements[i]; if (liElement.getAttribute('title') == buttonTitle) { if (buttonTitleParts.length == 1) { liElement.style.display = 'none'; break; } else { /* We want to hide a menu item in a drop-down menu. Find the descendant text element with the specified text. Then find its parent list item and hide it: */ menuText = buttonTitleParts[1]; var spanElements = liElement.getElementsByTagName('span'); for (var k = 0; k < spanElements.length; k++) { spanElement = spanElements[k]; if (spanElement.className == 'ms-crm-MenuItem-Text' ) { textElement = spanElement.firstChild; if (textElement != null && textElement.nodeType == 3) /* 3 = Node.TEXT_NODE */ { if (textElement.data == menuText) { liMenuItemElement = spanElement.parentNode.parentNode.parentNode; liMenuItemElement.style.display = 'none'; break; } } } } } } } } } } } } } Источник: http://crmdelacreme.blogspot.com/201...ttonsmore.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
Опции темы | Поиск в этой теме |
Опции просмотра | |
|