<div class="control-section">
<ejs-treegrid #treegrid [dataSource]='data' idMapping='TaskID' parentIdMapping='ParentItem' [treeColumnIndex]='1' allowPaging='true' [pageSettings]='pageSetting' [query]="query">
<e-columns>
<e-column field='TaskID' headerText='Task ID' width='120' textAlign='Right'></e-column>
<e-column field='TaskName' headerText='Task Name' width='150'></e-column>
<e-column field='StartDate' headerText='Start Date' width='120' format="yMd" textAlign='Right'></e-column>
<e-column field='EndDate' headerText='End Date' width='120' format="yMd" textAlign='Right'></e-column>
<e-column field='Duration' headerText='Duration' width='110' textAlign='Right'></e-column>
<e-column field='Progress' headerText='Progress' width='110'></e-column>
</e-columns>
</ejs-treegrid>
</div>
[app.compnent.ts]
import { Component, OnInit } from '@angular/core'
import { DataManager, WebApiAdaptor, Query } from '@syncfusion/ej2-data';
const SERVICE_URI: string = 'https://ej2services.syncfusion.com/production/web-services/api/SelfReferenceData' ;
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
})
export class AppComponent implements OnInit {
public data: DataManager;
public query: Query;
ngOnInit(): void {
this.data = new DataManager({ url: SERVICE_URI , adaptor: new WebApiAdaptor, crossDomain: true });
this.query = new Query().addParams("hi", "hi");
}
} |
|
<div class="control-section">
<ejs-treegrid #treegrid [dataSource]='data' idMapping='TaskID' parentIdMapping='ParentItem' hasChildMapping='isParent' [treeColumnIndex]='1' [query]="query">
<e-columns>
<e-column field='TaskID' headerText='Task ID' width='120' textAlign='Right'></e-column>
<e-column field='TaskName' headerText='Task Name' width='150'></e-column>
<e-column field='StartDate' headerText='Start Date' width='120' format="yMd" textAlign='Right'></e-column>
<e-column field='EndDate' headerText='End Date' width='120' format="yMd" textAlign='Right'></e-column>
<e-column field='Duration' headerText='Duration' width='110' textAlign='Right'></e-column>
<e-column field='Progress' headerText='Progress' width='110'></e-column>
</e-columns>
</ejs-treegrid>
</div> |
public ActionResult UrlData(DataManagerRequest dm, string ExportType)
{
DataOperations dp = new DataOperations();
List<TreeDataFormat> data = TreeDataFormat.GetDataFormat();
-----------
if (!dm.RequiresCounts && dm.Select != null)
{
dp.PerformSelect(data, dm.Select);
return Json(data);
}
return Json(new { result = data.ToList(), count = data.Count });
} |