18.11.2010, 11:54 | #1 |
Участник
|
Изменение Fetch в crmGrid
У меня в фпейме отображается crmGrid. Заполняется фрейм таблицей кодом.
Код: crmForm.all.IFRAME_invoice.src = path + "oId=" + id + "&oType=" + type + "&security=" + security + "&tabSet=" + tabSet3; Код: var oGrid = frameDoc.getElementById("crmGrid"); |
|
18.11.2010, 12:27 | #2 |
Чайный пьяница
|
Цитата:
Сообщение от Kipetcoff
У меня в фпейме отображается crmGrid. Заполняется фрейм таблицей кодом.
Код: crmForm.all.IFRAME_invoice.src = path + "oId=" + id + "&oType=" + type + "&security=" + security + "&tabSet=" + tabSet3; Код: var oGrid = frameDoc.getElementById("crmGrid"); PS ну и как всегда совет - переставайте читать копипастеров. Обращайтесь к первоисточникам - http://mscrm4ever.blogspot.com/2009/...me-part-2.html
__________________
Эмо разработчик, сначала пишу код, потом плачу над его несовершенством. Подписывайтесь на мой блог, twitter и YouTube канал. Пользуйтесь моим Ultimate Workflow Toolkit |
|
18.11.2010, 14:10 | #3 |
Участник
|
Повесил на Onload формы такую штуку
Код: var fetchBase = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'><entity name='new_pminvoice'><attribute name='new_invoicenumber'/><attribute name='new_date'/><attribute name='new_organization'/><attribute name='new_account'/><attribute name='transactioncurrencyid'/><attribute name='new_summa'/><attribute name='statuscode'/><attribute name='new_pminvoiceid'/><order attribute='new_invoicenumber' descending='false'/>"; var fetchLayout = "<grid name='resultset' object='10009' jump='new_invoicenumber' select='1' icon='1' preview='1'><row name='result' id='new_pminvoiceid'><cell name='new_invoicenumber' width='100'/><cell name='new_date' width='100'/><cell name='new_organization' width='100'/><cell name='new_account' width='100'/><cell name='new_summa' width='100'/><cell name='transactioncurrencyid' width='100'/><cell name='statuscode' width='100'/></row></grid>"; function OnSearch() { window.fetchAccounts = new FetchViewer("IFRAME_invoice"); fetchAccounts.Entity = "new_pminvoice"; fetchAccounts.FetchXml = getFetchXml(); fetchAccounts.LayoutXml = getLayoutXml(); fetchAccounts.QueryId = "{8465BADD-CFAC-42CD-A578-7846C1358ED8}"; fetchAccounts.RegisterOnTab(0); //replaceheaders(); } //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// function Clear() { var fields = document.getElementsByTagName("input"); for (var i = 0; i < fields.length; i++) { if (fields[i].type == "text") { if ((fields[i].value != null) && (fields[i].value != "")) { fields[i].value = ""; } } } } function getFetchXml() { var fetchQuery = fetchBase; var currId = crmForm.ObjectId; fetchQuery += '<link-entity name="new_pmsupreq" from="new_pmsupreqid" to="new_suprequestid">'+ '<link-entity name="new_new_pmrequest_new_pmsupreqmany" from="new_pmsupreqid" to="new_pmsupreqid">'+ '<filter>'+ '<condition attribute="new_pmrequestid" operator="eq" value="' + currId + '" />' + '</filter>'+ '</link-entity>'+ '</link-entity>'; fetchQuery += '</entity></fetch>'; return fetchQuery; } function getLayoutXml() { return fetchLayout; } function FetchViewer(iframeId) { var Instance = this; var vDynamicForm; var m_iframeTab; var m_iframeDoc; Instance.Entity = ""; Instance.Iframe = null; Instance.FetchXml = ""; Instance.QueryId = ""; Instance.LayoutXml = ""; Instance.RegisterOnTab = function(tabIndex) { Instance.Iframe = document.getElementById(iframeId); if (!Instance.Iframe) return alert("Iframe " + iframeId + " is undefined"); m_iframeDoc = getIframeDocument(); var loadingGifHTML = "<table height='100%' width='100%' style='cursor:wait'>"; loadingGifHTML += "<tr>"; loadingGifHTML += "<td valign='middle' align='center'>"; loadingGifHTML += "<img alt='' src='/_imgs/AdvFind/progress.gif'/>"; loadingGifHTML += "<div/><b>Loading View...</b>"; loadingGifHTML += "</td></tr></table>"; m_iframeDoc.body.innerHTML = loadingGifHTML; if (parseInt("0" + tabIndex) == 0) Instance.Refresh(); else Instance.Iframe.attachEvent("onreadystatechange", RefreshOnReadyStateChange); } function RefreshOnReadyStateChange() { if (Instance.Iframe.readyState != 'complete') return; Instance.Refresh(); } Instance.Refresh = function() { if (!Instance.Iframe) return alert("Iframe " + iframeId + " is undefined"); m_iframeDoc = getIframeDocument(); Instance.Iframe.detachEvent("onreadystatechange", RefreshOnReadyStateChange); var create = m_iframeDoc.createElement; var append1 = m_iframeDoc.appendChild; vDynamicForm = create("<FORM name='vDynamicForm' method='post'>"); var append2 = vDynamicForm.appendChild; append2(create("<INPUT type='hidden' name='FetchXml'>")); append2(create("<INPUT type='hidden' name='LayoutXml'>")); append2(create("<INPUT type='hidden' name='EntityName'>")); append2(create("<INPUT type='hidden' name='DefaultAdvFindViewId'>")); append2(create("<INPUT type='hidden' name='ViewType'>")); append1(vDynamicForm); vDynamicForm.action = prependOrgName("/AdvancedFind/fetchData.aspx"); vDynamicForm.FetchXml.value = Instance.FetchXml; vDynamicForm.LayoutXml.value = Instance.LayoutXml; vDynamicForm.EntityName.value = Instance.Entity; vDynamicForm.DefaultAdvFindViewId.value = Instance.QueryId; vDynamicForm.ViewType.value = 1039; vDynamicForm.submit(); Instance.Iframe.attachEvent("onreadystatechange", OnViewReady); } function OnViewReady() { if (Instance.Iframe.readyState != 'complete') return; Instance.Iframe.style.border = 0; Instance.Iframe.detachEvent("onreadystatechange", OnViewReady); m_iframeDoc = getIframeDocument(); m_iframeDoc.body.scroll = "no"; m_iframeDoc.body.style.padding = "0px"; } function getIframeDocument() { return Instance.Iframe.contentWindow.document; } } function checkEnter(e) { //e is event object passed from function invocation var characterCode; //literal character code will be stored in this variable if (e && e.which) { //if which property of event object is supported (NN4) e = e characterCode = e.which //character code is contained in NN4's which property } else { e = event characterCode = e.keyCode //character code is contained in IE's keyCode property } if (characterCode == 13) { //if generated character code is equal to ascii 13 (if enter key) OnSearch(); //submit the form return false } else { return true } } function setIframeHeight(iframeName) { var iframeEl = document.getElementById ? document.getElementById(iframeName) : document.all ? document.all[iframeName] : null; if (iframeEl) { iframeEl.style.height = "auto"; iframeEl.style.height = getSize() - iframeEl.offsetTop + "px"; } } function getSize() { var myHeight = 0; if (typeof (window.innerWidth) == 'number') { //Non-IE myHeight = window.innerHeight; } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) { //IE 6+ in 'standards compliant mode' myHeight = document.documentElement.clientHeight; } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) { //IE 4 compatible myHeight = document.body.clientHeight; } return myHeight; } function prependOrgName(url) { var location = document.location.href; var org = document.location.search.substring(document.location.search.indexOf('=') + 1, document.location.search.length).toLowerCase(); if (document.location.host.toLowerCase().indexOf(org) != -1) { //IFD return url; } else { return (url.charAt(0) == '/') ? "/" + org + url : "/" + org + "/" + url; } } function initIframe() { crmForm.all.IFRAME_invoice.document.body.style.backgroundColor = "#E3EFFF"; setIframeHeight('IFRAME_invoice'); OnSearch(); } initIframe(); Код: function getIframeDocument() { return Instance.Iframe.contentWindow.document; } |
|
18.11.2010, 14:33 | #4 |
Участник
|
эта ошибка вызывается при вызове метода OnViewReady
|
|
18.11.2010, 16:02 | #5 |
Участник
|
нашел ошибку...метод function prependOrgName возвращал какой-то шлак
|
|
|
|