Atozed Forums
Async refreshing data table plug-in - 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: Async refreshing data table plug-in (/thread-3647.html)



Async refreshing data table plug-in - David1 - 11-23-2023

Hello,
I am using a data table plug-in from DataTables in my IW app.
I would like to call the reload method inside a TIWButton async click event.

Now I wrote the following code which work fine in non async event:

  FOrder.ExcludeShippingCost := not FOrder.ExcludeShippingCost;
  if (FOrder.ExcludeShippingCost) then
    EXCLUDESHIPPINGCOSTBUTTON.Caption := 'Add shipping'
  else
    EXCLUDESHIPPINGCOSTBUTTON.Caption := 'Remove shipping';
  WebApplication.CallBackResponse..AddJavaScriptToExecute('$(''#' + FDataTableId + ''').DataTable().ajax.reload();');


In async event the above code don't work (probably cause the event is already async).
How can I call the javascript function in async click event?

Thank you,
Davide


RE: Async refreshing data table plug-in - wieczy - 03-08-2024

Hi Davide,

I'm using always (C++ code):

WebApplication->ExecuteJS("$(\"#TBLIWGRID1_MVFRAME\").DataTable().ajax.reload(null,false);");

works great for me.

Greetings