Hello.
I am having a serious problem with Data Grid.
Here is a short description:
1) I have a data grid with around 200 records, 50 per page.
2) I perform filtering programmatically
Filtering works perfectly, I can see a grid with only those data which have desired values (i.e. 70 rows, 50 on the first page, and 20 on the second page).
3) I need to immediately select all filtered values, so calling:
4) Unfortunately, i.e. there are 70 values after filtering - I can see only 50 selected. It looks that selection happens only for the current page.
What I tried:
- putting a dummy list of indexes from 0 - 69 as a parameter in ej2Grid.selectRows but only 0-49 were actually selected.
Can you please advise?
|
App.component.ts
actionComplete(args) {
if (args.requestType === 'filtering' && args.action === 'filter') {
this.grid.selectionModule.selectRowsByRange(
0,
this.grid.getCurrentViewRecords().length - 1
);
}
if (
args.requestType === 'paging' &&
this.grid.filterSettings.columns.length
) {
this.grid.selectionModule.selectRowsByRange(
0,
this.grid.getCurrentViewRecords().length - 1
);
}
} |
Hi Ajith,
We have a problem here, as we don't only want to show selection to the user, but also submit the rows to some backend API. Your approach only works for the page with which the user is interacting.
Let me share a scenario:
1) User has a page size of 5
2) The users filters certain column and it has a total of 10 rows in ejs grid
3) Now user goes to page 2 and deselect the 7th row
4) Now he has total 9 selections
How can we cover this kind of use case?
|
App.component.ts
actionComplete(args) {
if (args.requestType === 'filtering' && args.action === 'filter') {
(this.grid.selectionModule as any).checkSelectAll(); // select all the data here
}
}
onFltrClick(args) {
console.log(this.grid.getFilteredRecords()); // get the filtered records here
}
onSelectedRecordClick(args) {
console.log(this.grid.getSelectedRecords());
} |
Hi,
I am not using checkbox selection. Please provide a solution where we select rows using mouse click and not using checkboxes.
I would appreciate a stackblitz for that.
Thanks
|
public ngOnInit(): void {
this.data = orderDetails;
this.selectOptions = { persistSelection: true, type: 'Multiple' };
this.editSettings = { allowDeleting: true };
this.toolbar = ['Delete'];
}
actionComplete(args) {
if (args.requestType === 'filtering' && args.action === 'filter') {
(this.grid.selectionModule as any).checkSelectAllAction(true);
}
}
|
Hi Joseph,
Thanks for your assistance. The last solution works for me perfectly!
Regards,
Aleksandra