Options

JavaScript Add-In ascertain height?

bernd_swissbernd_swiss Member Posts: 3
edited 2015-03-16 in NAV Three Tier
I have a simple Add-In to show html text in a page (NAV2013 R2).
Explanation:
I give the text from NAV to the Add-In with function "DataFromCALToJavaScript".
The Add-In shows the Text in the page.
Problem:
With long text, the Add-In shows no scrollbar.
But...
When I have a link in the html text and I click on it (in the page)...a have the scrollbar...all is wonderful.
Question:
What can I do to have the same? I would like to have a resized Add-In with scrollbar.
The size in the NAV-Page is not static, I can not start the add-in with fixed height.


Page:


Code:
Visual Studio Class
using Microsoft.Dynamics.Framework.UI.Extensibility;

namespace Microsoft.Dynamics.Nav.Custom
{
    [ControlAddInExport("ShowHTMLwithNAV")]
    public interface ControlAddIn
    {
        [ApplicationVisible]
        event ApplicationEventHandler ControlAddInReady;

        [ApplicationVisible]
        void DataFromCALToJavaScript(object data);
    }
}

Manifest.xml
<?xml version="1.0" encoding="utf-8" ?>
<Manifest>
  <Resources>
    <Script>Control.js</Script>
  </Resources>

  <ScriptUrls>
    <ScriptUrl>http://code.jquery.com/jquery-1.9.1.min.js</ScriptUrl>
  </ScriptUrls>

  <Script>
    <![CDATA[
        $(document).ready(function() 
        { 
            InitializeControl();
            Microsoft.Dynamics.NAV.InvokeExtensibilityMethod('ControlAddInReady', null);
        });
        ]]>
  </Script>

  <VerticalStretch>true</VerticalStretch>
  <HorizontalStretch>true</HorizontalStretch>
</Manifest>

JavaScript: Control.js
function InitializeControl() {
}

function DataFromCALToJavaScript(data) {
    $("#controlAddIn").empty();
    $("#controlAddIn").append(data);
}

Answers

  • Options
    kinekine Member Posts: 12,562
    I think it is limitation of the JAvaScript addin - because the size of the addin is defined in the manifest, you cannot change it in run-time. It is biggest issue to have some generic addin. I remember Vjeko talking about this on NAVTechDays...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    bernd_swissbernd_swiss Member Posts: 3
    Thanks for this information.
    It is not the solution that I hoped for.
    I hope Microsoft give a solution in a next release for a better integration with JavaScript.
Sign In or Register to comment.