Grid PreSelected rows

Hi,
How can I select a row via javascript in a secondary page not visible?

Example: I have a 20 rows grid in 2 pages.
I want to preselect a row in page 2.
How can I do it?



1 Reply

VA Venkatesh Ayothi Raman Syncfusion Team June 14, 2018 12:34 AM UTC

Hi Mini, 

Thanks for using Syncfusion products. 

We have achieved your requirement using actionComplete event and selectRow API in Grid. This event triggers when Grid action success. Please refer to the following code example, 
grid.actionComplete = (args)=> { 
       
      if(args.requestType == 'paging' && grid.pageSettings.currentPage == 2){ 
        grid.selectRow(1); //select one row based on index 
              

Note: We have pre-select the records when active page is two. 

We can also select multiple records by using selectRows API in Grid. Please refer to the following code example, 
let grid: Grid = new Grid( 
       
            dataSource: data, 
            allowPaging:true, 
            pageSettings:{pageSize:10}, 
            selectionSettings: { type: 'Multiple' }, 
            columns: [ 
. .  
           
        }); 
    grid.appendTo('#Grid'); 
     
    grid.actionComplete = (args)=> { 
       
      if(args.requestType == 'paging' && grid.pageSettings.currentPage == 2){ 
        grid.selectRows([2,3,4]);//select multiple row based on indexes 
     
       
   


We have also prepared a sample for your convenience which can be referred from following link, 

If we misunderstood your requirement, then could you please provide more details about your requirement? 


Regards, 
Venkatesh Ayothiraman. 


Loader.
Up arrow icon