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

推荐订阅源

量子位
B
Blog
Last Week in AI
Last Week in AI
Jina AI
Jina AI
WordPress大学
WordPress大学
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
宝玉的分享
宝玉的分享
T
Tailwind CSS Blog
P
Proofpoint News Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
Google DeepMind News
Google DeepMind News
U
Unit 42
雷峰网
雷峰网
J
Java Code Geeks
Apple Machine Learning Research
Apple Machine Learning Research
MongoDB | Blog
MongoDB | Blog
F
Fortinet All Blogs
美团技术团队
Y
Y Combinator Blog
腾讯CDC
B
Blog RSS Feed
T
The Blog of Author Tim Ferriss
Microsoft Azure Blog
Microsoft Azure Blog
Recent Announcements
Recent Announcements

博客园 - delphi中间件

postgresql建库建表脚本 ubuntu配置postgresql远程访问 ubuntu安装postgresql数据库 delphi 面向模型编程 array of TVarRec core.recordModel.pas 使用泛型序列结构体 DDD建模指导 rabbitMQ VS mqtt redis流的应用场景 redis消费者组 redis流的操作命令 领域服务与领域事件 业务规则和模型 限界上下文与统一语言 领域驱动 mqtt即时通讯 ActiveRecord ORM RAD(速成应用开发) unigui插件框架 工厂流水线式自动生产UNIGUI WEB软件 delphi cs\web一种统一的界面风格 - delphi中间件 - 博客园 单据工厂 用json元数据填充模板 mormot2 ORM rest vs jsonrpc SSE技术详解:使用 HTTP 做服务端数据推送应用的技术 http持久连接 json-rpc 2.0 MCP服务器
动态生成unidbgrid
delphi中间件 · 2026-05-08 · via 博客园 - delphi中间件

动态生成unidbgrid

列的json元数据

        "单据信息":[
            {"caption":"条码","fieldname":"tiaoma","width":147,"filtering":"true","showsum":false,"readonly":true},
            {"caption":"商品","fieldname":"shangpinmingcheng","width":300,"filtering":"false","showsum":false,"readonly":true},
            {"caption":"单位","fieldname":"danwei","width":64,"filtering":"false","showsum":false,"readonly":true},
            {"caption":"规格","fieldname":"guige","width":137,"filtering":"false","showsum":true,"readonly":true},
            {"caption":"采购价","fieldname":"caigoujia","width":93,"filtering":"false","showsum":true,"readonly":false},
            {"caption":"采购数量","fieldname":"CaiGouShuLiang","width":93,"filtering":"false","showsum":true,"readonly":false},
            {"caption":"采购金额","fieldname":"CaiGouJinE","width":93,"filtering":"false","showsum":true,"readonly":true}
        ]        
procedure TBill.BillDetail;
begin
  grid.Columns.Clear;
  grid.Columns.BeginUpdate;
  try
    //action column
    var column: TUniBaseDBGridColumn := grid.Columns.Add;
    column.ActionColumn.Enabled := True;
    column.Title.Caption := '操作';
    column.Width := 64;
    var btn: TUniCustomButtonItem := column.ActionColumn.Buttons.Add as TUniCustomButtonItem;
    btn.ButtonId := 0;
    btn.Hint := '删除';
    btn.ImageIndex := 3;
    //其他列
    for var i: Integer := 0 to bill.O[billType].A[BillInfo].Count - 1 do
    begin
      var obj: JO := bill.O[billType].A[BillInfo].Items[i] as JO;
      var col: TUniBaseDBGridColumn := grid.Columns.Add;
      col.FieldName := obj.S['fieldname'];
      col.Title.Caption := obj.S['caption'];
      col.Width := obj.I['width'];
      col.Filtering.Enabled := obj.B['filtering'];
      if col.Filtering.Enabled then
        col.Filtering.Editor := barcodeControl;
      col.ShowSummary := obj.B['showsum'];
      col.ReadOnly := obj.B['readonly'];
    end;
  finally
    grid.Columns.EndUpdate;
  end;
end;