+ Start a Discussion

How to resize an iframe(S-control) dynamically

Hi I have an s-control on the detail page of Opportunity which displays a list of records. but i want to resize the iframe based on the list( i.e either increase or decrease its height) Tried using the resize snippets provided in the help and training, but my does'nt seems to work if i include the snippets. Also tried using the following function posted in the blog http://community.salesforce.com/sforce/board/message?board.id=ajax_toolkit&message.id=3626 function resizeIframe(height) { var id = new String(window.name); var iframeElement = parent.document.getElementById(id); iframeElement.style.height = height + "px" } But not sure how to use this, what parameter i need to pass to this function. this is my s-control
<script src="/soap/ajax/9.0/connection.js" type="text/javascript"></script> <script> var queryResult = sforce.connection.query("select Id, Name, Attachment_Type__c from Attachment_Custom__c where Related_Opportunity__c = '{!Opportunity.Id}'"); var output = "
"; output += "
Attachment Name
"; output += "
Attachment Type
"; //get the records array var records = queryResult.getArray('records'); //loop through the records and construct html string for (var i = 0; i < records.length; i++) { var Attachment = records[i]; //alert(Attachment ); output += "
"; output +="
" + Attachment .Name + "
"; output += "
" + Attachment .Attachment_Type__c + "
"; } document.write(output); output += ""; </script>
I have been tring since a long time but not able resolve it. It will be great if any one help's me out solving this. Any pointers will be of great help. Thanks in advance.
I had a similar experience a while ago. Another dev board member was able to help me out. Check out this thread