01-31-2022 05:12 PM
I am going through the tutorial "Working with a Data Table"
https://www.alfresco.com/abn/adf/docs/tutorials/working-with-data-table/
When I am trying to run the code in "Playing with the data source" section, I get a error said
"
ERROR in app/src/app/mydatatable/mydatatable.component.ts:17:35 - error TS2339: Property 'webScript' does not exist on type 'AlfrescoApi'.
17 this.apiService.getInstance().webScript.executeWebScript(
"
How to fix it? or any materials I should read?
My mydatatable.component.ts code:
import { Component, OnInit } from '@angular/core'; import { AlfrescoApiService } from '@alfresco/adf-core'; import { ObjectDataTableAdapter, ObjectDataRow } from '@alfresco/adf-core'; @Component({ selector: 'aca-mydatatable', templateUrl: './mydatatable.component.html', styleUrls: ['./mydatatable.component.scss'] }) export class MydatatableComponent implements OnInit { data = new ObjectDataTableAdapter([],[]); constructor(private apiService: AlfrescoApiService) { this.apiService.getInstance().webScript.executeWebScript( 'GET', 'people', [], null, 'api/-default-/public/alfresco/versions/1', null ).then( (response: any) => { let results = []; for (var entry of response.list.entries) { results.push({ id: entry.entry.id, firstName: entry.entry.firstName, lastName: entry.entry.lastName, status: 'green', icon: 'material-icons://accessibility' }); } this.data.setRows(results.map(item => { return new ObjectDataRow(item); })); } ); } ngOnInit(): void { } onRowClick(event: any) { alert('We just clicked row id: ' + event.value.obj.id); } }
Thanks.
03-28-2022 04:39 AM
The tutorial may be out of date. I think the webscript has been deprecated from newer versions of the ADF and it is no longer available. I used EcmUserService and it worked.
05-25-2022 07:27 AM
hei sorry to bother can you give a example of the new solution ?
06-01-2022 03:56 AM
Use the EcmUserService.
constructor(private userService:EcmUserService) { } getAllUsers(): void { this.userService.peopleApi.listPeople().then( (data:any) => { data = data.list.entries; }, (error: HttpErrorResponse) => { console.log (error.name + ' ' + error.message); }); }
Then use data however you like to, just like any variable in angular.
06-27-2022 04:07 PM
Hi! Could you explain to me where you found these? The EcmUserService isn't listed verbatim in the documentation?
06-30-2022 08:50 AM
look at these links:
https://www.alfresco.com/abn/adf/docs/core/services/ecm-user.service/#
and use it in this way:
Explore our Alfresco products with the links below. Use labels to filter content by product module.