【问题标题】:Ag grid with Angular2带有 Angular2 的 Ag 网格
【发布时间】:2018-03-16 16:47:23
【问题描述】:

根据我的申请,我有一些关于 AG Grid 实施的问题。 如何使用 Ag 网格执行 CRUD 操作,Ag 网格应包含 select/richSelect、日期字段、列内的复选框。 我正在显示来自数据库表的现有记录,并且我在网格的最后提供新记录(空记录)以插入新记录。 我能够在列中显示文本,但我无法显示 日期,选择/丰富选择,数据库表中现有记录的复选框。 在这个新的空记录中,一些列包含复选框、select/richSelect、Date vales。

【问题讨论】:

    标签: angular2-forms ag-grid


    【解决方案1】:

    要显示复选框并将其绑定到数据(真/假),请在定义 columnDefs 时尝试此代码。

     columnDefs: [               
                {
                    headerName: 'Admin', 
                    field: 'isAdmin',
                    cellRenderer: (params) => {
                        if (params.value) {
                            return `<input type="checkbox" checked  />`;
                        }
                        else {
                            return `<input type="checkbox"  />`;
                        }
                    }
                }                
            ]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-05-24
      • 2019-04-20
      • 2017-09-26
      • 2016-05-19
      • 2020-08-19
      • 1970-01-01
      • 2018-12-08
      • 2018-08-02
      相关资源
      最近更新 更多