Atozed Forums
Send data from Delphi to web client - 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: Send data from Delphi to web client (/thread-102.html)



Send data from Delphi to web client - radub - 04-19-2018

Hello,

We have IW 14.2 along with XE5.
Our html contains DataTables plugin.
Tu supply data to DataTables we're trying to use a Delphi function but we don't know how to make the function to return this data to the DataTables js function.
We cannot find a way to register either a callback real function (not a procedure), or to pass out/var parameter(s) from the procedure.

Any help, example, demo will be much appreciated!

Thank you


RE: Send data from Delphi to web client - kudzu - 04-19-2018

FWIW, DataTables is in the soon plans for 17. Smile

For 14, you can use REST. But its probably easier just to embed your data in the DOM:
https://datatables.net/examples/data_sources/dom.html

There are several ways to do this, but it could be as simple as using an IWLabel with RawText (not best option, but quick)


RE: Send data from Delphi to web client - radub - 04-20-2018

Thank you for the answer.
For the time beeing we'll wiat for v17.


RE: Send data from Delphi to web client - kudzu - 04-20-2018

17 is still a ways out, but within months we will have usable betas and are already deploying basic apps online today.


RE: Send data from Delphi to web client - Jose Nilton Pace - 04-21-2018

(04-19-2018, 03:41 PM)radub Wrote: Hello,

We have IW 14.2 along with XE5.
Our html contains DataTables plugin.
Tu supply data to DataTables we're trying to use a Delphi function but we don't know how to make the function to return this data to the DataTables js function.
We cannot find a way to register either a callback real function (not a procedure), or to pass out/var parameter(s) from the procedure.

Any help, example, demo will be much appreciated!

Thank you

Hi, You can use an IWTemplateProcessor wich have a Event called OnUnknowTag to full data to use in DataTable.
Other way is put a IWLabel and set Properties RawText := True; Full data to iwlabel and use in DataTable.
Other way is OnFormRender add a var with data like Self.JavaScript.Add( 'var myData = xyz'); and use myData on DataTable.

I don't use DataTable ok. Is ideas to test and adapt to your case.


RE: Send data from Delphi to web client - kev13in - 04-27-2018

^^ Can you share the screenshot on how to?


RE: Send data from Delphi to web client - Jose Nilton Pace - 04-27-2018

PHP Code:
;procedure TIWForm1.IWAppFormRender(SenderTObject);
begin
   Self
.JavaScript.Add'var w_v_l = ["2018/01","2018/02"]' );
end
HTML/JavaScript
PHP Code:
var config_v = {
 
   type'line',
 
   labelsw_v_l  <=== 

IWTemplateProcessorHTML
PHP Code:
procedure TIWForm1.IWTemplateProcessorHTMLUnknownTag(const ANamestring; var VValuestring);
begin
   
//AName in your HTML {%myDataTableData%}
 
  if AName 'myDataTableData' then
      VValue 
:= 'record, record2, record3, etc';
end



RE: Send data from Delphi to web client - radub - 06-13-2018

Thank you for the solutions.
Finally I've manage to create a file and pass its path to the DataTables which happily show the data.