$("#dataManager").click(function () {
dataManager = ej.DataManager({
url: window.baseurl + "Wcf/TreeGridGantt/TreeGantt.svc/SelfReferenceDatas",
crossDomain: true,
offline:true
});
var treegridObj = $("#TreeGridContainer").ejTreeGrid("instance");
var query = ej.Query().sortBy("TaskID", ej.sortOrder.Descending, false);
treegridObj.refresh(dataManager, query)
}) |
$("#updateRecord").click(function () {
var treegridObj = $("#TreeGridContainer").ejTreeGrid("instance");
treegridObj.refreshRow(3);//Passing the edited record index
}) |
click (event) {
var dataManager = new ej.DataManager(this.treeData),
treegridObj = $("#TreeGridControl").ejTreeGrid("instance"),
query = new ej.Query().sortBy("taskID", ej.SortOrder.Descending, false);
treegridObj.refresh(dataManager, query);
} |
clickRow (event) {
var treeObj = $("#TreeGridControl").ejTreeGrid("instance"),
item = treeObj.model.updatedRecords;
if(item.length > 0){
item[2].taskName = "NewName";
//To refresh the required record
treeObj.refreshRow(2);
}
} |
Hi Allyson,We have analyzed the reported error in our sample but unable to replicate it. Hence, we have prepared the sample and refreshed TreeGrid data source using “refresh” method.Please find the code example below:
click (event) {var dataManager = new ej.DataManager(this.treeData),treegridObj = $("#TreeGridControl").ejTreeGrid("instance"),query = new ej.Query().sortBy("taskID", ej.SortOrder.Descending, false);treegridObj.refresh(dataManager, query);}Please find the code example to refresh particular row using “refreshRow” method.
clickRow (event) {var treeObj = $("#TreeGridControl").ejTreeGrid("instance"),item = treeObj.model.updatedRecords;if(item.length > 0){item[2].taskName = "NewName";//To refresh the required recordtreeObj.refreshRow(2);}}Please find the sample from below locationPlease share your TreeGrid related code snippets or demo sample, if you are facing the same error again. We will help you to resolve this error.Regards,Jayakumar D
[default.html]
<button (click)='handleClick($event)' type='button'>Modify Record</button>
<div class="control-section">
<ejs-treegrid #treegrid [dataSource]='data' height='400' childMapping='subtasks' [treeColumnIndex]='1' [editSettings]='editSettings' [toolbar]='toolbar'>
-------
</ejs-treegrid>
</div>
……………………………………………………………………………………..
[default.component.ts]
import { Component, OnInit, ViewChild } from '@angular/core';
import { sampleData } from './jsontreegriddata';
import { ChangeEventArgs } from '@syncfusion/ej2-dropdowns';
import { TreeGridComponent , EditService , ToolbarService , PageService } from '@syncfusion/ej2-angular-treegrid';
import { DataManager, Query} from '@syncfusion/ej2-data';
@Component({
selector: 'control-content',
templateUrl: 'default.html',
providers: [EditService , ToolbarService , PageService]
})
export class DefaultComponent implements OnInit {
------
@ViewChild('treegrid')
public treegrid: TreeGridComponent;
ngOnInit(): void {
------
}
handleClick(event: Event) {
this.treegrid.grid.editModule.updateRow(0,{"taskID":1,"taskName": "Modifed","startDate": new Date(),"duration": 10})
}
} |