![](/img/trans.png)
[英]PrimeNg Angular9 i am using p-tree custom api and its not working
[英]though it is repeated question but how can i display new row in the first row i am using angular9
我可以添加一个新行,但它在最后一页上。 我想显示在第一行。 谁能帮我解决这个问题? HTML 组件
<button mat-button color="primary" (click)="addRow()">
<mat-icon>add</mat-icon>
<span>Add</span></button>
ts代码
addRow(){
this.agGrid.api.applyTransaction({
add: [{make: '', model: '', price: ''}]
});
您可以在网格 Api 上使用updateRowData
方法,该方法允许您指定要插入的索引。 将您的addRow
方法更改为:
addRow() {
let newRows = [{ make: "", model: "", price: '' }];
this.gridApi.updateRowData({ add: newRows, addIndex: 0 });
}
看看 这个StackBlitz。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.