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.
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.
hei sorry to bother can you give a example of the new solution ?
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.
Hi! Could you explain to me where you found these? The EcmUserService isn't listed verbatim in the documentation?
look at these links:
https://www.alfresco.com/abn/adf/docs/core/services/ecm-user.service/#
and use it in this way:
Discussions, help and advice about the Alfresco Development Framework.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.