|
export class AppComponent {
public ngOnInit(): void {
this.data = orderDataSource;
onClick() { //button click event
var grid = (document.getElementById('Normalgrid') as any).ej2_instances[0];
var obj = {OrderID: 10009, CustomerID: "John", ShipCountry:"Russia"};
grid.addRecord(obj, 3); //Add a new record at specifc row index
}
}
|
|
App.component.html
<ejs-grid #normalgrid id='Normalgrid' (actionBegin)='actionBegin($event)' (rowSelected)='rowselected($event)' [dataSource]='data' allowPaging='true' [pageSettings]='pageSettings' [editSettings]='editSettings' [toolbar]='toolbar'>
<e-columns>
-------------------------
</e-columns>
</ejs-grid> |
|
App.component.ts
public index:number=0;
rowselected(args){
this.index=args.rowIndex;
}
onClick() {
var obj = {OrderID: 10009, CustomerID: "John", ShipCountry:"Russia"};
this.grid.addRecord(obj,this.index);
} |
|
App.component.html
<ejs-grid #normalgrid id='Normalgrid' (actionBegin)='actionBegin($event)' (rowSelected)='rowselected($event)' [dataSource]='data' allowPaging='true' [pageSettings]='pageSettings' [editSettings]='editSettings' [toolbar]='toolbar'>
<e-columns>
-------------------------
</e-columns>
</ejs-grid> |
|
App.component.ts
public index:number=0;
rowselected(args){
this.index=args.rowIndex;
}
actionBegin(args){
if(args.requestType==="save"){
args.index=this.index;
}
} |
Sorry to bother you,
i've got a similar problem but in my case the grid is in batch edit mode.
Is there something i can do to add a new row in a specific position?
Giuseppe,
In EJ2 Grid’s batch editing mode, when you use the addRecord method to add a new record, the newly added row appears at the top. This behavior occurs because the selection is applied to the new row, treating its row index as 0. As a result, the Grid doesn’t retain your specified index, it is not feasible to insert the newly added row at a specific position.
Do you think that in the future the "duplicate a row in a specified position in batch mode" it will be a feature for the future?
Because in my company we are evaluating the use of syncfusion with angular but we need the batch mode and the duplicate.
Hi Giuseppe Innocenti,
We have considered the report case as an improvement feature on our end and logged a task titled “Need to provide support for adding a row at specific index using addRecord method in batch mode of editing”. During the planning stage for each release cycle, we review all open features and identify those for implementation based on specific parameters such as product vision, technological feasibility, and customer interest. This feature will be included in one of our upcoming releases.
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.
We do not have an immediate plan to implement this feature, but it will be included in one of our upcoming releases. Please cast your vote on this feature. Based on the customer demand we will prioritize the features in our upcoming road map. You can communicate with us regarding open features at any time using the above feedback link.
Regards
Aishwarya R