AXForum  
Вернуться   AXForum > Microsoft Dynamics CRM > Dynamics CRM: Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 12.04.2009, 16:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,617 / 848 (80) +++++++
Регистрация: 28.10.2006
mscrm4ever: CRM 4.0 Many 2 Many IFrame Viewer
Источник: http://mscrm4ever.blogspot.com/2009/...me-viewer.html
==============

I’ve seen many posts about displaying a many 2 many grid inside an iframe so I didn’t post about it my self until now.

One of the disadvantages of using such customization is that it does not follow ms initial execution path which breaks some of the functionality.

In our case after you select an existing item the grid does not refresh / reflect your selection until you push the refresh button your self.

I wrote a small utility class that solves that problem. It also takes care of the iframe padding.

Basically a many to many iframe looks like this:

areas.aspx?oId={ObjectId}&oType={ObjectTypeCode}&security=852023&roleOrd=1&tabSet=area{relationship name}

The viewer accepts the RoleOrder and Relationship Name (TabsetId) and constructs the iframe for you.

Add the code in the entity onload event and Enjoy…


function OnCrmPageLoad()
{
/* Create a ne N2NViewer and give it the IFRAME (container) id */
var n2nViewer = new N2NViewer('IFRAME_account_association');
/* Set the role order - use iedevtoolber for exact parameters */
n2nViewer.RoleOrder = 1;
/* assing the relationship name (without the "area" word) */
n2nViewer.TabsetId = "gi_account_account";
/* Do the trick... */
n2nViewer.Load();
}

function N2NViewer(iframeId)
{
if (!document.all[iframeId])
{
alert(iframeId + " is missing!");
return;
}

var viewer = this;
var _locAssocObj = null;

viewer.IFRAME = document.all[iframeId];
viewer.RoleOrder;
viewer.TabsetId;

viewer.Load = function()
{
/* Construct a valid N2N IFRAME url */
viewer.IFRAME.src = "areas.aspx?oId=" + crmForm.ObjectId + "&oType=" + crmForm.ObjectTypeCode + "&security=" + crmFormSubmit.crmFormSubmitSecurity.value + "&roleOrd=" + viewer.RoleOrder + "&tabSet=area" + viewer.TabsetId;
viewer.IFRAME.onreadystatechange = viewer.StateChanged;
}

viewer.StateChanged = function()
{
if (viewer.IFRAME.readyState != 'complete')
{
return;
}

var iframeDoc = viewer.IFRAME.contentWindow.document;

/* Reomve scrolling space */
iframeDoc.body.scroll = "no";
/* Remove crmGrid Default padding */
iframeDoc.body.childNodes[0].rows[0].cells[0].style.padding = 0;

/* Save MS locAssocObj */
_locAssocObj = locAssocObj;
/* Override MS locAssocObj */
locAssocObj = viewer.locAssocObj;
}

viewer.locAssocObj = function(iType , sSubType, sAssociationName, iRoleOrdinal)
{
/* Open the Dialog */
_locAssocObj(iType , sSubType, sAssociationName, iRoleOrdinal);
/* Refresh only if our iframe contains the correnct tabset name */
if (sAssociationName == viewer.TabsetId)
{
viewer.IFRAME.contentWindow.document.all.crmGrid.Refresh();
}
}
}

//Entry Point
OnCrmPageLoad();



Источник: http://mscrm4ever.blogspot.com/2009/...me-viewer.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Microsoft Dynamics CRM Team Blog: Building Rich-Client Dashboards for Microsoft Dynamics CRM with Windows Presentation Foundation Blog bot Dynamics CRM: Blogs 1 31.03.2009 13:24
mscrm4ever: Display Fetch in IFRAME – Part 2 Blog bot Dynamics CRM: Blogs 0 12.03.2009 07:05
Microsoft Dynamics CRM Team Blog: List Web Part for Microsoft Dynamics CRM 4.0 Deployment Scenarios Blog bot Dynamics CRM: Blogs 0 30.01.2009 22:05
Microsoft Dynamics CRM Team Blog: Microsoft Dynamics CRM 4.0 Bookshelf Blog bot Dynamics CRM: Blogs 1 22.01.2009 04:46
Microsoft Dynamics CRM Team Blog: Quick Tip: Passing CRM Form values to an IFrame Blog bot Dynamics CRM: Blogs 0 12.09.2008 02:05

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 19:18.