devextreme-angular icon indicating copy to clipboard operation
devextreme-angular copied to clipboard

DataGrid with angular2

Open 14Muhammad opened this issue 10 years ago • 3 comments

Hello,

Have you any example to use DataGrid with angular-2 while passing settings in json from component not directly in the view ?

For example:

    <dx-data-grid [dataSource]="projects"
                  [allowColumnResizing]="true"
                  [hoverStateEnabled]="false"
                  [allowColumnReordering]="true"
                [searchPanel]="{visible: true}"
                  [paging]="{pageSize: 5}"
                 [pager]="{showInfo:true,showNavigationButtons:true,showPageSizeSelector:true}"
                  [rowAlternationEnabled]="true"
                  [selection]="{mode: 'none'}"
                  [editing]="{mode: 'form',allowUpdating: true,allowDeleting: true,allowAdding: true, texts:{addRow: 'Add a project'}}"
                  [export]="{enabled: true,fileName:'Projects',allowExportSelectedData: true}"
                  [groupPanel]="{visible: true}"
                  [filterRow]="{visible: true,applyFilter: 'auto'}"
                  [selection]="{mode: 'single'}">
    </dx-data-grid>

How we can pass json objects from component to view? while in above example json objects are directly mentioned in view.

Regards, Ali

14Muhammad avatar Jul 12 '16 10:07 14Muhammad

Hi,

You can find an example of complex property usage in our sample app. Please check how the chart's series property is bound in the app.component.html file and declared in the app.component.ts file.

dxbykov avatar Jul 12 '16 13:07 dxbykov

@dxbykov Thanks for your prompt response. Please let me know If I want to call some function from json object component. In your given example there are only binding for properties. What if I want to use some function e.g. onCellClick for dxDataGrid. How we can achieve this in Component of TypeScript? Regards, Ali

14Muhammad avatar Jul 13 '16 09:07 14Muhammad

You can find an example in the comment I've recently posted. Just replace the onCellPrepared entry with the onCellClick one.

dxbykov avatar Jul 14 '16 16:07 dxbykov