Syncfusion Angular:我想以编程方式在网格中添加多行



我在syncfusion treegrid中对以编程方式添加多行有疑问,我可以添加多行,但它会添加到最后一行,但我想在指定索引处添加多行。

我正在分享一个代码片段,请查看。

copy() {
this.MultiSelect = true;
var allselected = this.treegrid.getSelectedRecords();
var rows = this.treegrid.getSelectedRows();
this.copiedRow = rows;
var crows = [];
for (let index = 0; index < allselected.length; index++) {
crows.push(allselected[index]['taskData']);
}
this.copiedRows = crows;
this.copiedRow.forEach(x => {
x.setAttribute('style', 'background:pink;');
});
}
paste() {
if(this.copiedRows.length>0)
{
var filteredcopiedrows = this.copiedRows;
var tree = document.getElementsByClassName("e-treegrid")[0]['ej2_instances'][0];
var temp = tree.dataSource.slice()
filteredcopiedrows.forEach(data => {
temp.push(data);
});
this.treegrid.dataSource = temp;
this.dataService.pushData(this.treegrid.dataSource);

this.copiedRow.forEach(x => {
x.setAttribute('style', 'background:white;');
});
this.copiedRows = [];
}
}

目前我们不支持"使用addRecord方法添加具有RowPosition的多个记录"。我们已将其记录为功能改进。对这一改进的支持将包含在我们即将发布的任何版本中。请根据客户需求对此功能进行投票,我们将在即将发布的路线图中实施这些功能。

您现在可以通过以下反馈链接跟踪此功能的当前状态,
https://www.syncfusion.com/feedback/27035/need-to-provide-support-for-addition-of-multiple-records-using-addrecord-method

最新更新