External JS with template

<< Click to Display Table of Contents >>

Navigation:  Forum >

External JS with template

Forum link

 


 

04-13-2021, 10:39 AM:

 

My application using HTML bootstrap templates with datatables.

 

I will insert whis javascript: https://datatables.net/extensions/dateti...datatables

 

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

 

Is there a change implement with external .js file?

 


 

04-15-2021, 10:10 AM:

 

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/...nsNoCookie