Atozed Forums
External JS with template - Printable Version

+- Atozed Forums (https://www.atozed.com/forums)
+-- Forum: Atozed Software Products (https://www.atozed.com/forums/forum-1.html)
+--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html)
+---- Forum: English (https://www.atozed.com/forums/forum-16.html)
+----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html)
+----- Thread: External JS with template (/thread-2366.html)



External JS with template - matija - 04-13-2021

My application using HTML bootstrap templates with datatables.

I will insert whis javascript: https://datatables.net/extensions/datetime/examples/integration/datatables

To much source for execute with WebApplication.CallBackResponse.AddJavaScriptToExecute!

Is there a change implement with external .js file?


RE: External JS with template - Alexandre Machado - 04-15-2021

You can just copy the whole JS content to a file, name it whatever you want (E.g. "CustomDataTable.js") and save it inside application's wwwroot folder.

Then you add it to the IWForm's ContentFiles at design time or at run time, with no path (because it is relative to wwwroot folder):

procedure TIWForm1.IWAppFormCreate(Sender: TObject);
begin
ContentFiles.Add('CustomDataTable.js');
end;

If you want to see other uses of DataTables with IntraWeb I suggest you try this example as well:

(it shows some other features that you may not need, but focus on the DataTables usage)

https://github.com/Atozed/IntraWeb/tree/master/15/Delphi/MultipleSessionsNoCookie