How to create dxi-column with dataType dynamically in dxdatagrid?

瘦欲@ 提交于 2019-12-23 19:10:28

问题


We are developing an angular application. I have to display records in a dxdatagrid having

  1. Each time the schema will be different.Data coming from different table.

  2. want to add/edit records

  3. want to display controls corresponding to each data type

Any one please help to achieve the same.


回答1:


You can use the attribute [columns] on your dx-data-grid.

Example: on your component

const columns =  [{
        dataField: 'id',
        caption: 'Id',
        width: 100,
        dataType: number 
    }, {
        dataField: 'Name',
        caption: 'Name',
        width: 500,
        dataType: string
    }];

on your view

<dx-data-grid id="gridExample"
              [dataSource] = "dataSource" 
              [columns] = "columns">
</dx-data-grid>

References: https://js.devexpress.com/Documentation/ApiReference/UI_Widgets/dxDataGrid/Configuration/columns/



来源:https://stackoverflow.com/questions/50738343/how-to-create-dxi-column-with-datatype-dynamically-in-dxdatagrid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!