- Home
- Forum
- Angular - EJ 2
- Different version
Different version
Hello,
Got a simple question to ask.
Does tree grid editing work (with template and etc) in ej2-angular-treegrid 17.1.49 version ?
SIGN IN To post a reply.
3 Replies
DR
Dinesh Rajendiran
Syncfusion Team
November 18, 2019 08:54 AM UTC
Hi Domantas,
Thanks for using Syncfusion Products.
The editing feature will work in the TreeGrid ej2-Angular version “17.1.49” with templates. We have included a sample in which AutoComplete component is rendered using editTemplate to “TaskName” column of TreeGrid.
Please refer the link below.
If you need further assistance please get back to us.
Regards,
Dinesh Rajendiran
DO
Domantas
November 18, 2019 02:58 PM UTC
Hello,
Is it possible to change attached template on go?
Let's say on initial load I have one template and if I'm editing the column second time I'm changing the attached template to different template.
I've tried this.grid.getColumnByField('ColumnField').edit = this.newTemplate;
But it seems that it doesn't work for me
EDIT: refreshColumns() refreshes template but it also refreshes my actions, cause I do apply template on beginEdit action so it will blur out my editing, so it would be great if I could do it without refreshColumns() method
DR
Dinesh Rajendiran
Syncfusion Team
November 19, 2019 01:39 PM UTC
Hi Domantas,
In write event we have rendered the DropDownList component for specific cell by checking the condition and for the other cells we have rendered the AutoComplete component. In the read event also we have returned values from either autocomplete or dropdown component based on CSS class added in element. . Please refer the code snippet below
|
read: (args) => {
if(args.classList.contains("e-autocomplete")){
return this.autoCompleteObj.value;
}
else
return this.dropDown.value;
}
write: (args: { rowData: Object, column: Column, element: HTMLElement }) => {
if(args.rowData["taskName"] == "Design"){
this.dropDown = new DropDownList({
dataSource: <{ [key: string]: Object }[] >this.treegrid.grid.dataSource,
fields: {value: 'taskName', text:"taskName"}
});
this.dropDown.appendTo(args.element);
}else{
this.autoCompleteObj = new AutoComplete({
dataSource: <{key: string, value: any}[]>this.treegrid.grid.dataSource,
fields: { value: 'taskName' },
value: args.rowData[args.column.field]
});
this.autoCompleteObj.appendTo(args.element);
}
} |
Same as this you can render multiple components in the TreeGrid columns.
If you need further assistance please get back to us.
Regards,
Dinesh Rajendiran
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
DO Domantas
- Nov 15, 2019 02:33 PM UTC
- Nov 19, 2019 01:39 PM UTC