AL icon indicating copy to clipboard operation
AL copied to clipboard

HTML pages parts

Open Gallimathias opened this issue 7 years ago • 4 comments

For the add-ins it would be nice if we could use not only JavaScript files and Cascadien Style Sheets but also HTML files.

It is annoying to have to change the HTML by Javascript, because unfortunately no formatters or IntelliSens tools work here.

So it would be nice that you can choose between Start Script and Start HTML for each addin.


Old

Current test.js file

var addin = document.getElementById("controlAddIn");
addin.innerHTML = "\
<form action=\"/things\"\
    class=\"olla\"\
    id=\"olla-add-in\">\
</form>\
";

Current addin file

controladdin EpicAddIn{
    Scripts = 'js/test_functions.js';
    StartupScript = 'js/test.js';
    
}

New

nicer test.js file

var crazy= doCrazyShit();

HTML file

 <script src="test.js"></script> 
<form action="/things"
    class="olla"
    id="olla-add-in">
</form>

Current addin file

controladdin EpicAddIn{
    Scripts = 'js/test_functions.js', 'js/test.js';
    HTMLParts = 'html/nice.html';
    StartupHTML = 'html/test.html';
    
}

Gallimathias avatar Dec 04 '17 14:12 Gallimathias

Thanks for the suggestion. In meantime, if you're up to it, you could try using React or Angular. They both give you the possibility to generate HTML in JavaScript, but it's much easier than writing vanilla JS to create UI. This could be of course a bit heavy for simple things, but might as well be a good solution for complex add-ins.

defr0std avatar Dec 05 '17 14:12 defr0std

Thanks for the tip @dennisfrostlander. I know both frameworks but hadn't thought about it yet ^^. A little too hard for our current projects. Especially in terms of performance. I think until this function comes, we'll make it in the native js way.

Gallimathias avatar Dec 05 '17 14:12 Gallimathias

@dennisfrostlander

Could you give an example (or maybe a link ?) of how to implement React in an AL controladdin ? I can't find any source about that

judecot avatar Oct 26 '18 14:10 judecot

We haven't tried using React in AL ourselves so can't provide any examples. Please try the community forums: Business Central Community mibuso forum Dynamics User Group

StanislawStempin avatar Oct 26 '18 14:10 StanislawStempin

Hi! This issue is beyond the scope of the AL language and development tools. Please go ahead and post this to our Ideas forum at https://aka.ms/BusinessCentralideas, or vote up the idea if its already there. We're constantly monitoring top Ideas and will consider them for a future release.

thpeder avatar Nov 30 '23 08:11 thpeder