Hello,
Alfresco Angular 2 Components Catalog describes how you can set the default folder for the document-list dynamically. This is the snippet from the website:
import { ChangeDetectorRef } from '@angular/core';
import { AlfrescoApiService } from 'ng2-alfresco-core';
export class FilesComponent implements OnInit {
currentFolderId: string = '-my-';
constructor(private apiService: AlfrescoApiService,
private changeDetector: ChangeDetectorRef) {
// ...
}
ngOnInit() {
let nodes: any = this.apiService.getInstance().nodes;
nodes.getNodeInfo('-root-', {
includeSource: true,
include: ['path', 'properties'],
relativePath: '/Sites/swsdp/documentLibrary'
})
.then(node => {
console.log(node);
this.currentFolderId = node.id;
this.changeDetector.detectChanges();
});
}
}
I've tested it on 1.7.0 and it only works when running the angular app on my local machine. As soon as I deploy it on a remote testserver (still intranet) it sometimes, but not always, doesn't show the desired folder specified by relativePath, but navigates to the path currentFolderId initially was set to. In this case -my-.
Changing
currentFolderId: string = '-my-';
to
currentFolderId: string;
solves the problem for me but I don't know if this is really the right technique or if I was just lucky.
Hi ,
can you check if there are failing calls in your browser network console?
Here are the requests for currentFolderId: string = '-root-';
And here the requests for currentFolderId:
string
;
No request fails.
The problem appears a lot in Internet Explorer, but I've also seen it in Firefox a few times.
As this only occurs when the application runs on the remote server I was thinking that the longer time the requests take plays a role. So I've simulated a network delay on the server with "tc qdisc add dev eth0 root netem delay 500ms". I've tried a few different ms values but everytime I delay the traffic the problem doesn't even occur.
Do you have errors in the console log?
No, I only get these messages since I've updated to ADF 1.7.0:
ContentColumnComponent is deprecated starting with 1.7.0 and may be removed in future versions. Use DataColumnComponent instead.
For testing on my local machine I am using the Alfresco SDK with the community edition and on the remote testing server the enterprise edition is installed. Is it possible that this has something to do with the problem?
Honestly, I don't think but which version do you have for the community and the enterprise?
Community - 5.2.0 (r135134-b14)
Enterprise - 5.2.0 (r134899-b26)
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.