惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

量子位
云风的 BLOG
云风的 BLOG
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
The Hacker News
The Hacker News
Martin Fowler
Martin Fowler
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
U
Unit 42
F
Full Disclosure
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Recorded Future
Recorded Future
Security Archives - TechRepublic
Security Archives - TechRepublic
阮一峰的网络日志
阮一峰的网络日志
T
Threatpost
P
Privacy International News Feed
GbyAI
GbyAI
Stack Overflow Blog
Stack Overflow Blog
MongoDB | Blog
MongoDB | Blog
I
Intezer
Recent Announcements
Recent Announcements
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
P
Privacy & Cybersecurity Law Blog
A
Arctic Wolf
博客园 - 聂微东
博客园 - 叶小钗
Cisco Talos Blog
Cisco Talos Blog
H
Help Net Security
S
Schneier on Security
Y
Y Combinator Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
T
The Exploit Database - CXSecurity.com
T
Tor Project blog
月光博客
月光博客
NISL@THU
NISL@THU
A
About on SuperTechFans
Spread Privacy
Spread Privacy
Blog — PlanetScale
Blog — PlanetScale
D
DataBreaches.Net
雷峰网
雷峰网
C
CXSECURITY Database RSS Feed - CXSecurity.com
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 【当耐特】
G
Google Developers Blog
W
WeLiveSecurity
P
Palo Alto Networks Blog
The Last Watchdog
The Last Watchdog
K
Kaspersky official blog
博客园 - 司徒正美
L
LINUX DO - 热门话题
小众软件
小众软件

博客园 - delphi中间件

ActiveRecord ORM RAD(速成应用开发) unigui插件框架 工厂流水线式自动生产UNIGUI WEB软件 delphi cs\web一种统一的界面风格 - delphi中间件 - 博客园 动态生成unidbgrid 单据工厂 用json元数据填充模板 mormot2 ORM rest vs jsonrpc SSE技术详解:使用 HTTP 做服务端数据推送应用的技术 http持久连接 json-rpc 2.0 MCP服务器 RTTI对性能的影响 频繁地创建和销毁对象 TMultiPartFormData 雪花ID core.binary.pas TJSONToDataSetBridge TIcsMQTTServer 咏南WEB开发框架 UnimList卡片显示 UnimTabPanel tabsheet在下面 unipagecontrol tabsheet在下面 unitreemenu自动显示滚动条 uniimbitbtn手机按钮一些设置
unigui ajax交互
delphi中间件 · 2025-12-27 · via 博客园 - delphi中间件

unigui ajax交互

//'<button onclick="ajaxRequest(Menu.UnimList1, ''test'', [''param0=0'',''param1=1'']);">按钮</button>'
procedure TMenu.UnimFormCreate(Sender: TObject);
begin
  unimList1.Items.Add(
  '<h1>商品档案</h1>'
  +'<button onclick="ajaxRequest(Menu.UnimList1, ''spda'', [' + QuotedStr('class=TSpda') + ']);">打开</button>'
      );
end;

procedure TMenu.UnimList1AjaxEvent(Sender: TComponent; EventName: string;
  Params: TUniStrings);
begin
  try
    TUnimFormClass(FindClass(Params['class'].Value)).Create(UniApplication).Show;
  except
    on E: Exception do
      ShowMessage(className+'正在开发..');
  end;
end;
//'<button onclick="ajaxRequest(Menu.UnimList1, ''test'', [''param0=0'',''param1=1'']);">按钮</button>'
procedure TMenu.UnimFormCreate(Sender: TObject);
begin
    for var i: Integer := 0 to 4 do    begin
      unimList1.Items.Add(
      '<h1>'+i.ToString+'</h1>'
      +'<button onclick="ajaxRequest(Menu.UnimList1, ''test'', [' + QuotedStr('id='+i.ToString) + ']);">按钮</button>'
      );
    end;
end;

procedure TMenu.UnimList1AjaxEvent(Sender: TComponent; EventName: string;
  Params: TUniStrings);
begin
if SameText('test', EventName) then
  ShowMessage(Params['id'].Value);
end;
procedure TMenu.UnimFormCreate(Sender: TObject);
begin
    for var i: Integer := 0 to 4 do    begin
      unimList1.Items.Add(
'<h1>'+i.ToString+'</h1>'
+' <button onclick="abtnclick('''+i.ToString+''')">按钮</button>'
+   ' </div>  '
      );
    end;
(* 按钮点击事件JS处理代码
创建aaa.js文件,内容如下:
function abtnclick(id){
  ajaxRequest(Menu.UnimList1, 'test',['id=' + id]);
}
ServerModule.CustomFiles 添加一行:
files\aaa.js
*)

end;

procedure TMenu.UnimList1AjaxEvent(Sender: TComponent; EventName: string;
  Params: TUniStrings);
begin
if EventName ='test' then
UnimList1.Items[strtoint(Params.Values['id'])]:=
'  <h1>'+Params.Values['id']+' 已处理</h1>'
+' <button disabled  onclick="abtnclick('''+Params.Values['id']+''')">按钮</button>'
+   ' </div>  '
  ;
end;