We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Ability to use checkbox to select filtered records

Thread ID:

Created:

Updated:

Platform:

Replies:

131804 Jul 27,2017 06:30 PM UTC Jul 31,2017 04:28 PM UTC Angular 5
loading
Tags: ejGrid
Zack
Asked On July 27, 2017 06:30 PM UTC

<ej-grid #grid
[allowPaging]="true"
[allowSelection]="true"
[selectionType]="multiple"
[pageSettings]="{ pageSize: 10}"
(actionBegin)="onBegin($event)"
[allowSorting]="true"
[allowFiltering]="true"
(actionComplete)="onComplete($event)"
[filterSettings]="{ filterType: 'excel' }"
[dataSource]="groups">
<e-columns>
<e-column field="isSelected" type="checkbox" width="75" textAlign="right"></e-column>
<e-column field="identification" [isPrimaryKey]=true headerText="Cow ID" width="150"></e-column>
</e-columns>
</ej-grid>

onComplete(event) {
     if(event.requestType === 'batchsave'){
      console.log(event);
          let filteredRecords = this.grid.widget.getFilteredRecords();
          if(filteredRecords.length > 0){
               // something like this to set the selected records equal to the filtered records
               this.grid.widget.model.selectedRecords = this.grid.widget.getFilteredRecords();
     }
}

I have an issue where I can't select the filtered records, only all the records. I have the check for when I want to set it, I have the
records I want to set as the selected ones, I just don't have how to set them, could not find a "setSelectedRecords" method in the api.


Zack
Replied On July 27, 2017 09:05 PM UTC

I also noticed I am unable to deselect the checkboxes after checking them though I can deselect all of them using the header column checkbox


Thavasianand Sankaranarayanan [Syncfusion]
Replied On July 28, 2017 03:26 PM UTC

Hi Zack, 

Thanks for contacting Syncfusion support. 

Before proceeding to your queries, we need some clarifications. 

  1. In requestType batchSave, you have copied the filtered records to selected records. Please share your clear requirement on this.
  2. Exact scenario that you want get filtered record details.
  3. If you need header checkbox selection then you no need to set field for that column. But in your code example you have set field for check box column.
  4. Share screen shot or video demonstration of your requirement.
  5. Essential studio version.

Regards, 
Thavasianand S. 


Zack
Replied On July 28, 2017 05:55 PM UTC

In requestType batchSave, you have copied the filtered records to selected records. Please share your clear requirement on this.

Need to be able to filter grid and then select filtered records

Exact scenario that you want get filtered record details.

Select the filtered records and have them available under the selected records of the model or set the isSelected field of the record to true and others to false. I intend once I have the selected records (either in an array or with the 'isSelected' flag set to true for selected records) to then perform some mass edits. At which point I will send to a server. The server will then send me back the data and update the table with the new edited data.

If you need header checkbox selection then you no need to set field for that column. But in your code example you have set field for check box column.

I'll look into this and report back 

Essential studio version.

ej-angular2: 15.1.33


Zack
Replied On July 28, 2017 06:05 PM UTC

Removing the isSelected as the field solved the necessary issue. I would like to have those checkboxes persist through the mass edit but obviously that is impossible since I'm refreshing the data and the state isn't tracked.


Thavasianand Sankaranarayanan [Syncfusion]
Replied On July 31, 2017 04:28 PM UTC

Hi Zack, 

Query 1: Get the filtered record in Grid. 

We suspect that you want to get filtered records from Grid and need to pass into server end. So, we suggest you to get the filtered records using getFilteredRecords() method of ejGrid control. Then you can able to pass the filtered records to server end. 

Refer the below screen shot. 

 

Refer the help documentation. 


Query 2: Removing the “isSelected” as the field solved the necessary issue. 

We regret for the inconvenience caused. 

We need to set the field for checkbox column then only we can able to persist the checkbox value after the Grid data get refreshed. 

Regards, 
Thavasianand S. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;