|
<< Click to Display Table of Contents >> Navigation: Forum > Send data from Delphi to web client |
04-19-2018, 03:41 PM:
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
04-19-2018, 10:02 PM:
FWIW, DataTables is in the soon plans for 17.
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)
04-20-2018, 10:31 AM:
Thank you for the answer.
For the time beeing we'll wiat for v17.
04-20-2018, 12:41 PM:
17 is still a ways out, but within months we will have usable betas and are already deploying basic apps online today.
04-21-2018, 01:31 PM:
(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.
04-27-2018, 07:32 AM:
^^ Can you share the screenshot on how to?
04-27-2018, 12:09 PM:
PHP Code:
;procedure TIWForm1.IWAppFormRender(Sender: TObject);
begin
Self.JavaScript.Add( 'var w_v_l = ["2018/01","2018/02"]' );
end;
HTML/JavaScript
PHP Code:
var config_v = {
type: 'line',
labels: w_v_l <===
IWTemplateProcessorHTML
PHP Code:
procedure TIWForm1.IWTemplateProcessorHTMLUnknownTag(const AName: string; var VValue: string);
begin
//AName in your HTML {%myDataTableData%}
if AName = 'myDataTableData' then
VValue := 'record, record2, record3, etc';
end;
06-13-2018, 06:09 AM:
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.