I tried to make a treeview, where the json come from a server using POST operation. In the post method, I need to send value in the body. For this I use
WebMethodAdaptor and
addParams for add the value. Here is my code:
export class AppComponent implements OnInit {
public hierarchicalData: Object[];
public projectId = 'projectID';
public value = 'C03374EC2';
public field: Object;
public ngOnInit(): void {
new DataManager({
url: SERVICE_URI,
adaptor: new WebMethodAdaptor
}).executeQuery(new Query().addParams(this.projectId, this.value))
.then((e: ReturnOption) => this.hierarchicalData = <Object[]>e.result).catch((e) => true);
this.field = { dataSource: this.hierarchicalData, id: 'zoneID', text: 'zoneName', child: 'subZone' };
}
}
Now the problem is the WebMethodAdaptor send data in the following formats,
{"value":{"params":{"projectID":"C03374EC2"},"projectID":"C03374EC2"}}
But I need,
{
"projectID":"C03374EC2"
}