问题
We are developing an angular application. I have to display records in a dxdatagrid having
Each time the schema will be different.Data coming from different table.
want to add/edit records
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