mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-10769] remove alfresco deps from datatable (#8045)
* remove alfresco dep * [ci:force] move data-column in datatable * new datatable service * doc * required changes * fix * fix
This commit is contained in:
@@ -5,7 +5,7 @@ Status: Active
|
||||
Last reviewed: 2019-04-12
|
||||
---
|
||||
|
||||
# [Data Column Component](../../../lib/core/src/lib/data-column/data-column.component.ts "Defined in data-column.component.ts")
|
||||
# [Data Column Component](../../../lib/core/src/lib/datatable/data-column/data-column.component.ts "Defined in data-column.component.ts")
|
||||
|
||||
Defines column properties for DataTable, Tasklist, Document List and other components.
|
||||
|
||||
|
56
docs/core/services/datatable.service.md
Normal file
56
docs/core/services/datatable.service.md
Normal file
@@ -0,0 +1,56 @@
|
||||
---
|
||||
Title: DataTable service
|
||||
Added: v6.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2023-01-01
|
||||
---
|
||||
|
||||
# [Datatable service](../../../lib/core/src/lib/datatable/services/datatable.service.ts "Defined in datatable.service.ts")
|
||||
|
||||
|
||||
## Details
|
||||
|
||||
If you need to update one row of your datatable you can use the ```DataTableService``` to update it.
|
||||
To update a single row you can use the rowUpdate subject.
|
||||
The model to update the DataTable require the ID of the row you want change and the new data Object of the row
|
||||
|
||||
```typescript
|
||||
DataRowUpdateModel {
|
||||
obj: any;
|
||||
id: string;
|
||||
}
|
||||
```
|
||||
|
||||
For example if your table use entry nodes you can pass:
|
||||
```typescript
|
||||
this.dataTableService.rowUpdate.next({id: node.id, obj: {entry: node}});
|
||||
```
|
||||
|
||||
As good practice is better to provide a DataTableService in the component where you are going to deliver the new object
|
||||
```typescript
|
||||
@Component({
|
||||
selector: 'app-files-component',
|
||||
templateUrl: './files.component.html',
|
||||
styleUrls: ['./files.component.scss'],
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
providers: [
|
||||
DataTableService
|
||||
]
|
||||
})
|
||||
export class FilesComponent implements OnInit {
|
||||
|
||||
constructor(private dataTableService: DataTableService,
|
||||
private nodeService: NodesApiService) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.nodeService.nodeUpdated.subscribe((node) => {
|
||||
this.dataTableService.rowUpdate.next({id: node.id, obj: {entry: node}});
|
||||
});
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [Datatable](../components/datatable.component.md)
|
Reference in New Issue
Block a user