$("#TreeGridContainer").ejTreeGrid({
//
rowSelected: function (args) {
//To expand/collapse the selected row
$("#TreeGridContainer").ejTreeGrid("expandCollapseRow", this.selectedRowIndex());
});
}); |
<style>
.e-treegrid .e-treegridcollapse:before {
font-size: 16px;
margin-top: -3px;
}
.e-treegrid .e-treegridexpand:before {
font-size: 12px !important;
margin-top: -1px;
}
</style> |
<ejs-treegrid :dataSource="data" :treeColumnIndex="0"idMapping="TaskID" parentIdMapping="parentID"ref="treegrid"
:rowSelecting="rowSelecting">
<e-columns>
<e-column field="TaskID" headerText="Task ID" width="90" isPrimaryKey="true"></e-column>
<e-column field="TaskName" headerText="Task Name" width="80"></e-column>
. . .
</e-columns>
</ejs-treegrid>
methods: {
rowSelecting(args) {
if(args.data.expanded){
this.$refs.treegrid.collapseRow(args.row,args.data); //using collapseRow method
}
else {
this.$refs.treegrid.expandRow(args.row,args.data); //using expandRow method
}
}
}; |