Getting Row Index while Pagination
New DiscussionHi All,
I have a Requirement where in i am displaying a igx-grid, which displays some columns as key values from JSON_A and a last column is a button which will actually open a dialog box to show the Complete JSON_A message from the row.
Now the issue is when we paginate this and the no of records in a page is restricted to 10. and we get around 50 records from api which we want to display in 5 pages.
Now First page works fine and gets the data in dialog as expected, but when we go to next page and click on the 2nd row button of second page to see 10(page 1)+2=12th row index JSON data, it shows first page 2nd index data instead of showing 12th index JSON.
Ex:
The column for Button in the grid is as follows:
<igx-column [width]=”‘150px'” field=”action” header=”Action”>
<ng-template igxCell let-cell=”cell”>
<button mdbBtn color=”primary” (click)=”getJSONData(cell)”>View Outbound</button>
</ng-template>
</igx-column>
getJSONData(event:IgxGridCellComponent){
const dataState1: IDataState2 = {
key: event.rowIndex,
rootLevel: false
};
console.log(“index:”+dataState1.key);
this.openAlertDialog(this.outboundUpdatesDataObject[dataState1.key]);
}
Interface:
export interface IDataState2 {
key: number;
rootLevel: boolean;
}
Can anyone help on how we can achieve this ?
A working Example would be very much helpful.
Thanks,
Subham
Sign In
to post a reply
Replies
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Favorites
0 Replies
1 Created On
Aug 19, 2020 Last Post
6 years ago